Failed to Create Data Directory - Google Chrome Cannot Read and Write Its Data Directory - Cordova Failed to Create Data Directory - Google Chrome Cannot Read and Write Its Data Directory - Cordova windows windows

Failed to Create Data Directory - Google Chrome Cannot Read and Write Its Data Directory - Cordova


This is because the script that launches chrome, uses a folder location that typically can't be created with your permissions. That folder is used for history, bookmarks, cookies, etc (ie user data). This is beneficial for testing out features in Chrome (plugins, etc) and not affecting your normal instance. I don't consider it much of a concern here, more of a nuisance message. If you don't like it you could always just manually create that folder on your system as well.

You can see this here what causes the issue

switch (process.platform) {  case 'darwin':    spawn('open', ['-n', '-a', 'Google\ Chrome', '--args', '--disable-web-security', '--user-data-dir=/tmp/temp_chrome_user_data_dir_for_cordova_browser', project]);    break;  case 'win32':    //TODO: Use regex to fix location of chrome.exe    //TODO: Get --user-data-dir to work for windows    spawn('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', ['--user-data-dir="C:/Chromedevsession"', '--disable-web-security', project]);    break;}

Since it can't use that folder, I believe it just reverts to the defaults which on Windows 10 would be

C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data\Default


I solved this issue by editing the run file (platforms/browser/cordova/run) and removing the speech marks from around C:/Chromedevsession on line 33.

The line now reads:

spawn('C:/Program Files (x86)/Google/Chrome/Application/chrome.exe', ['--user-data-dir=C:/Chromedevsession', '--disable-web-security', project]);


Remove Space in Path in Registry Policy

HKEY_CURRENT_USER\Software\Policies\Google\Chrome\UserDataDir

or

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\UserDataDir

Example:

${roaming_app_data}\Google\Chrome\User_Data

instead of

${roaming_app_data}\Google\Chrome\User Data