Ionic 2: 'ionic build ios' fails
Short description of the problem:
Build fails when I run 'ionic emulate ios' and 'ionic build ios'.
Also, I get a blank screen when I run 'ionic serve --lab', but loads when I enable the console log - not sure if this is related.
What behavior are you expecting?
Fails to build for ios.
Post the output of ionic info below please
Cordova CLI: 6.3.1 Ionic Framework Version: 2.0.0-rc.0 Ionic CLI Version: 2.1.4 Ionic App Lib Version: 2.1.2 Ionic App Scripts Version: 0.0.30 ios-deploy version: Not installed ios-sim version: 5.0.10 OS: Mac OS X El Capitan Node Version: v6.7.0 Xcode version: Xcode 8.0 Build version 8A218a
Other information: -
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle ionic-hello-world@~prebuild: ionic-hello-world@
6 silly lifecycle ionic-hello-world@~prebuild: no script for prebuild, continuing
7 info lifecycle ionic-hello-world@~build: ionic-hello-world@
8 verbose lifecycle ionic-hello-world@~build: unsafe-perm in lifecycle true
9 verbose lifecycle ionic-hello-world@~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/admin/Desktop/fireblogger/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
10 verbose lifecycle ionic-hello-world@~build: CWD: /Users/admin/Desktop/fireblogger
11 silly lifecycle ionic-hello-world@~build: Args: [ '-c', 'ionic-app-scripts build' ]
12 silly lifecycle ionic-hello-world@~build: Returned: code: 1 signal: null
13 info lifecycle ionic-hello-world@~build: Failed to exec build script
14 verbose stack Error: ionic-hello-world@ build: ionic-app-scripts build
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.ionic-app-scripts build
22 error Exit status 1
23 error Failed at the ionic-hello-world@ build script 'ionic-app-scripts build'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the ionic-hello-world package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ionic-app-scripts build
23 error You can get information on how to open an issue for this project with:
23 error npm bugs ionic-hello-world
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls ionic-hello-world
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
This is the error message from the command line..
MacBook:fireblogger admin$ sudo npm install -g ios-deploy
npm WARN lifecycle [email protected]~preinstall: cannot run in wd %s %s (wd=%s) [email protected] ./src/scripts/check_reqs.js && xcodebuild /usr/local/lib/node_modules/.staging/ios-deploy-298c9491 npm ERR! Darwin 15.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ios-deploy" npm ERR! node v6.7.0 npm ERR! npm v3.10.3 npm ERR! path /usr/local/lib/node_modules/ios-deploy/build/Release/ios-deploy npm ERR! code ENOENT npm ERR! errno -2 npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/ios-deploy/build/Release/ios-deploy' npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/local/lib/node_modules/ios-deploy/build/Release/ios-deploy' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent
npm ERR! Please include the following file with any support request: npm ERR! /Users/admin/Desktop/fireblogger/npm-debug.log MacBook:fireblogger admin$
My build also fails. Not sure why. I'm on node lts. Here's the output I see:
$ ionic build ios
Running 'build:before' npm script before build
> ionic-hello-world@ build /Users/garrettjensen/leaguespeed-mobile2
> ionic-app-scripts build
[20:29:35] ionic-app-scripts 0.0.36
[20:29:35] build prod started ...
[20:29:35] clean started ...
[20:29:35] clean finished in 6 ms
[20:29:35] copy started ...
[20:29:36] ngc started ...
[20:29:36] copy finished in 60 ms
[20:29:36] lint started ...
[20:29:38] lint finished in 1.98 s
[20:29:40] TypeError: this._input.charCodeAt is not a function
[20:29:40] ngc failed
[20:29:40] ionic-app-script task: "build"
[20:29:40] Error: Error
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ build: `ionic-app-scripts build`
npm ERR! Exit status 1
This is what my package.json looks like:
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"
},
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/compiler-cli": "0.6.2",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/platform-server": "2.0.0",
"@ionic/storage": "1.0.3",
"angular2-moment": "^1.0.0-beta.5",
"ionic-angular": "2.0.0-rc.1",
"ionic-native": "2.2.3",
"ionicons": "3.0.0",
"localforage": "^1.4.3",
"lodash": "^4.16.4",
"moment": "^2.15.1",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.21"
},
"devDependencies": {
"@ionic/app-scripts": "0.0.36",
"typescript": "^2.0.3"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "leaguespeed-mobile: An Ionic project"
}
The following command fails
sudo npm install -g ios-deploy
See debug log attached. npm-debug.log.txt
I have same issue, in my case i must add parameter on ElCaptain
sudo npm install -g ios-deploy --unsafe-perm=true --allow-root
see: https://github.com/phonegap/ios-deploy/issues/262
Thanks Lordfef. That works.
isn't a problem for ios-deploy to access other files then ? I did that and now i have another error:
2016-11-30 17:40:42.181 ios-deploy[2455:130632] [ !! ] Can't access app path '/Users/ludovicroux/Documents/PROJETS/BOARDLINE/dev/boardline/platforms/ios/build/device/Board.app' : No such file or directory
Hi guys, The following solution works for me:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo npm install -g ios-deploy --unsafe-perm=true --allow-root
Thanks, Nicholls
Nicholls Thank you so much...
Thanks @Lordfef. That worked like a charm.
Thanks @Lordfef. It worked.
thanks @Lordfef !