无法在 Cordova 5.0.0 中添加或构建 ios 平台

Can't add or build ios platform in Cordova 5.0.0

当我将 ios 平台添加到样板 Cordova 项目时,我遇到了这个问题:

jondamato$ cordova platform add ios

Adding ios project...
mv: no such file or directory: project.pbxproj

mv: dest is not a directory (too many sources)

mv: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/__PROJECT_NAME__-Info.plist

mv: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/__PROJECT_NAME__-Prefix.pch

mv: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/gitignore

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld.xcodeproj/project.pbxproj

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/Classes/AppDelegate.h

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/Classes/AppDelegate.m

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/Classes/MainViewController.h

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/Classes/MainViewController.m

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/main.m

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/hiworld-Info.plist

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/hiworld-Prefix.pch

sed: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/hiworld-Info.plist

rm: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/CordovaLib

cp: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld/.gitignore

grep: no such file or directory: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/hiworld.xcodeproj/project.pbxproj


/Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/lib/create.js:266
    throw new Error('Subproject: ' + subprojectPath + ' entry not found in
          ^
Error: Subproject: CordovaLib/CordovaLib.xcodeproj entry not found in project file
at update_cordova_subproject (/Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/lib/create.js:266:15)
at copyJsAndCordovaLib (/Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/lib/create.js:69:9)
at Object.exports.createProject (/Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/lib/create.js:202:5)
at Object.<anonymous> (/Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/create:53:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
Error: /Users/jondamato/.cordova/lib/npm_cache/cordova-ios/3.8.0/package/bin/create: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)

Cordova 似乎创建了项目文件但无法加载它们。当我尝试构建项目时,这是我得到的:

jondamato$ cordova build ios
cp: no such file or directory: *new/hiworld/config.xml

mkdir: path already exists: /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/www

cp: no such file or directory: *new/hiworld/www/css

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css
cp: no such file or directory: *new/hiworld/www/img

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css
cp: no such file or directory: *new/hiworld/www/img
cp: no such file or directory: *new/hiworld/www/img/logo.png

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css
cp: no such file or directory: *new/hiworld/www/img
cp: no such file or directory: *new/hiworld/www/img/logo.png
cp: no such file or directory: *new/hiworld/www/index.html

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css
cp: no such file or directory: *new/hiworld/www/img
cp: no such file or directory: *new/hiworld/www/img/logo.png
cp: no such file or directory: *new/hiworld/www/index.html
cp: no such file or directory: *new/hiworld/www/js

cp: no such file or directory: *new/hiworld/www/css
cp: no such file or directory: *new/hiworld/www/css/index.css
cp: no such file or directory: *new/hiworld/www/img
cp: no such file or directory: *new/hiworld/www/img/logo.png
cp: no such file or directory: *new/hiworld/www/index.html
cp: no such file or directory: *new/hiworld/www/js
cp: no such file or directory: *new/hiworld/www/js/index.js

Parsing /Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/__CLI__/config.xml failed
Error: ENOENT, no such file or directory '/Users/jondamato/cli/cordova/*new/hiworld/platforms/ios/__CLI__/config.xml'
    at Object.fs.openSync (fs.js:439:18)
    at Object.fs.readFileSync (fs.js:290:15)
    at Object.module.exports.parseElementtreeSync (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/util/xml-helpers.js:118:27)
    at Object.ConfigParser (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/configparser/ConfigParser.js:33:24)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:115:32
    at Array.map (native)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/prepare.js:70:40
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
    at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)

虽然初步构建文件最终在我的目录中。 谁能告诉我这是怎么回事?我已经卸载并重新安装了 Cordova 几次,希望它能有所帮助,但没有成功。

谢谢!

我发现我的目录名称中的星号让 Cordova 不知何故变得异常。只要确保您的 Cordova 项目不在名称中带有星号的文件夹中即可。