Ionic Cordova Error – ENOENT: no such file or directory

When trying to build (“ionic cordova build ios”) my Ionic Cordova project, I got this error: “Error: ENOENT: no such file or directory“.

Took me awhile to figure out since I had just copied the project from an older project, made a few changes etc. Turns out the cause was that I had used a slash (“/”) in the app name in config.xml, changing the name fixed the issue.

[code]Copying iOS template project to /xxx/platforms/ios
shell.js: internal error
Error: ENOENT: no such file or directory, rename ‘/xxx/platforms/ios/__TEMP__.xcodeproj’ -> ‘/xxx/platforms/ios/project/name.xcodeproj’
at Object.renameSync (fs.js:594:3)
at /xxx/node_modules/cordova-ios/node_modules/shelljs/src/mv.js:77:8
at Array.forEach (<anonymous>)
at Object._mv (/xxx/node_modules/cordova-ios/node_modules/shelljs/src/mv.js:53:11)
at Object.mv (/xxx/node_modules/cordova-ios/node_modules/shelljs/src/common.js:186:23)
at copyTemplateFiles (/xxx/node_modules/cordova-ios/bin/lib/create.js:124:11)
at Object.exports.createProject (/xxx/node_modules/cordova-ios/bin/lib/create.js:228:5)
at Api.createPlatform (/xxx/node_modules/cordova-ios/bin/templates/scripts/cordova/Api.js:122:14)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:188:28
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:854:54
[ERROR] An error occurred while running subprocess cordova.
cordova platform add ios –verbose –save exited with exit code 1.
Re-running this command with the –verbose flag may provide more information. [/code]