我有一个在Windows环境中构建的Ionic 2项目。我刚刚在OSX环境中设置了Ionic 2。
Your system information: Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on. 6.4.0 Ionic Framework Version: 2.0.0-rc.4 Ionic CLI Version: 2.1.18 Ionic App Lib Version: 2.1.9 Ionic App Scripts Version: 1.0.0 ios-deploy version: Not installed ios-sim version: Not installed OS: macOS Sierra Node Version: v6.9.4 Xcode version: Not installed
但是当我运行ionic serve
时,我收到以下错误:
Richards-MacBook-Pro:theWhoZoo-chat richardmarais$ sudo ionic serve
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
Install ios-sim to deploy iOS applications.`npm install -g ios-sim` (may require sudo)
Install ios-deploy to deploy iOS applications to devices. `npm install -g ios-deploy` (may require sudo)
******************************************************
> ionic-hello-world@ ionic:serve /Users/richardmarais/Development/ionic/theWhoZoo-chat
> ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
sh: /Users/richardmarais/Development/ionic/theWhoZoo-chat/node_modules/.bin/ionic-app-scripts: Permission denied
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world@ ionic:serve: `ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/richardmarais/Development/ionic/theWhoZoo-chat/npm-debug.log
There was an error serving your Ionic application: There was an error with the spawned command: serve
任何帮助表示感谢。
答案 0 :(得分:1)
您有权限问题
sh: /Users/richardmarais/Development/ionic/theWhoZoo-chat/node_modules/.bin/ionic-app-scripts: Permission denied
选项1:将权限更改为npm的默认目录
选项2:将npm的默认目录更改为另一个目录
选项3:使用包管理器来处理此问题。
有关详细信息,请访问以下链接:https://docs.npmjs.com/getting-started/fixing-npm-permissions
答案 1 :(得分:0)
您是否使用sudo安装软件包?