Cordova CLI: an error occurred during creation of ios sub-project

k2fx picture k2fx · Jul 21, 2013 · Viewed 10k times · Source

I've tested the Cordova 3.0.0 CLI Tool. The command

$ sudo cordova platform add android

was done OK. But i've got error during the command

$ sudo cordova platform add ios

Error

[Error: An error occured during creation of ios sub-project. /bin/sh: /Users/user/.cordova/lib/ios/cordova/3.0.0/bin/create: No such file or directory ]

When I decided to install a previous version

$ sudo npm install -g [email protected]

Yes, -

$ cordova platform add ios

command done his job. I got ios sub-project

I've Xcode 4.6.3 and xCode's Command Line tools are installed. Thanks in advance for any clue.

BTW, I'm not alone with such problem. Please see - PhoneGap CLI: "An error occured during creation of ios sub project" https://groups.google.com/forum/#!msg/phonegap/woWZzT39osg/CpK_rUIKmYAJ

Update: Fixed: the versioned folder was deleted i.e.

rm -rf ~/.cordova/lib/ios/cordova/3.0.0/

and after

$ sudo cordova platform add ios

ios platform was added with no errors.

Answer

Tom picture Tom · Aug 30, 2013

I had this problem after killing a previous cordova platform add command without letting it finish. It seems that it had partially downloaded the platform files, but terminating it left it in an inconsistent state. As you mentioned, deleting that directory and then re-running the command resolved the problem.

rm -rf ~/.cordova/lib/ios/cordova/3.0.0/
cordova platform add ios

BTW, you shouldn't need to use sudo here. It would be better to run these commands as a normal user.