Image Image Image Image Image
Scroll to Top

To Top

Information Resources

Cordova CLI Doesn’t Like Spaces

April 10, 2014 - Information Resources
Cordova CLI Has a Problem with Spaces

This is a quick trick for any Cordova coders operating on a Windows environment.

C:\app\cordova -d platforms add android
cordova library for "android" already exists. No need to download. Continuing.
Checking if platform "android" passes minimum requirements...
Creating android project...
Running command:
    cmd args=["/c",
        "C:\Users\My Account With Spaces\.cordova\lib\android\cordova\3.4.0\bin\create",
        "--cli",
        "C:\app\platforms\android",
        "com.mycompany.testapp",
        "Test App"]
'C:\Users\My' is not recognized as an internal or external command, operable program or batch file.

( Grrr )

Windows should probably know better than to create directories (especially often accessed ones, such as a user’s profile folder), if it doesn’t know how to later address them in command line.

If you’re scratching your head over this one, you can get around it by modifying the path.
Open superspawn.js, located  here:

C:\Users\[My Account With Spaces]\AppData\Roaming\npm\node_modules\cordova\src

Update the line that calls the command to use a symbolic link. It’s roughly line 57:

This:

cmd = resolvePath(cmd);

Becomes This:

cmd = cmd.replace('C:\Users\My Account With Spaces\.cordova','C:\cordovalink'); cmd = resolvePath(cmd);

Then, create a symbolic link at the new location C:\cordovalink, using this command:

C:\>mklink /D C:\cordovalink "C:\Users\My Account With Spaces\.cordova" symbolic link created for C:\cordovalink <<===>> C:\Users\My Account With Spaces\.cordova

Hopefully this will save you some time.

Tags | , , , , , , , , , , ,