问题描述
我是一名学生,今天我刚开始接触离子.我没有使用命令行的经验,所以我在这里很困惑.
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
(如果没有sudo,这些功能将无法正常工作).最后一个在日志中(在上面的其他内容中)产生此结果:
(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:
运行sudo npm install -g cordova ionic
时收到此警告:
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
然后,如果我尝试运行ionic
,我会收到一个-bash: ionic: command not found
错误,但是如果我运行sudo ionic
,它将把很多东西记录到控制台中.难道El Capitan的安全性更改有误吗?
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?
谢谢您的帮助.
推荐答案
在MAC上工作时,为避免不得不 sudo 在 npm 中所做的几乎所有操作,我的最佳建议是:
To prevent having to sudo almost anything you do in npm while working on MAC, my best advice is:
通过节点版本管理器 安装npm.
Install npm through Node Version Manager.
这篇关于ionic的新手-不能在El Capitan上针对ios(9)进行构建,并且需要sudo ionic,npmconf已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!