New to ionic - can’t build for ios (9) on El Capit

2019-09-12 07:46发布

I am a student and I just started with ionic today. I have no experience with command line usage so I am pretty stumped here.

When I try to run the basic template (tabs) with:

sudo ionic platform add ios
sudo ionic build ios
sudo ionic emulate ios

(these don't work without having the sudo there). the last one produces this in the logs (among other stuff above):

** BUILD SUCCEEDED **

No target specified for emulator. Deploying to iPhone-6 simulator
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=159):
Invalid device state
ENOENT: no such file or directory, stat '/Users/Dylan/Library/Logs/CoreSimulator/D0923A6C-7738-41BA-8134-ED747069991A/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/Dylan/myApp/platforms/ios/build/emulator/myApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--stdout,/Users/Dylan/myApp/platforms/ios/cordova/console.log,--exit
Error: /Users/Dylan/myApp/platforms/ios/cordova/run: Command failed with exit code 2

I have seen a few unsolved posts with the same errors but they haven't gotten anywhere. It could possibly be related to these following things here:

When running sudo npm install -g cordova ionic I get this warning:

npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm

Also, afterwards, if I try to run ionic I get a -bash: ionic: command not found error, but if I run sudo ionic then it logs a whole bunch of stuff to the console. Could this one be an error with security changes in El Capitan?

Thanks for your help in advance.

1条回答
劳资没心,怎么记你
2楼-- · 2019-09-12 08:25

To prevent having to sudo almost anything you do in npm while working on MAC, my best advice is:

Install npm through Node Version Manager.

查看更多
登录 后发表回答