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

4

7

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.

Elconin answered 21/7, 2013 at 13:56 Comment(0)
S
10

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.

Shellieshellproof answered 30/8, 2013 at 10:5 Comment(0)
C
7

I had the same problem and if you're also following PhoneGap 3.0 The Command Line Interface documentation and created the project by calling

$ cordova create HelloWorld com.example.hello "Hello World"

Then try removing the whitespace between Hello World.

$ cordova create HelloWorld com.example.hello "HelloWorld"

The reason it failed when adding android platform is because the command tries to create an Activity with the "Hello World". So removing the whitespace will resolve this issue.

Courageous answered 24/7, 2013 at 23:57 Comment(1)
i've no prob with adding android project. In my case I stuck on adding ios project. And solution from "updaet" part in my question has solved problem. In my case for some reason (network error or related), the cordova-ios repo was not downloaded and extracted as expected, and partial directories are created.Elconin
U
2

Sometimes this error occurs in Windows when the PATH variable is not set correctly to access "java" and "ant" exes. If you want to know if they are correctly set, you can just execute both (from any folder):

$ java

or

$ ant

and the program should be found.

Unfamiliar answered 14/10, 2013 at 7:58 Comment(0)
B
0

Two things that might also help:

In the above question, one line of command-line code is missing that is clearly shown in the docs:

$ cordova platform add android

I forgot that too and it caused the error mentioned in the question.

Also, if you happen like me to have added the plugins before realizing this error, there is no way to fix that except to delete the whole project and rebuilding it.

Bangs answered 21/9, 2013 at 18:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.