Macos 无法使用npm安装Ionic?(Mac OSX El Capitan 10.11.2)
我正在尝试使用npm在我的mac上安装Ionic,运行OSX El Capitan 10.11.2。Macos 无法使用npm安装Ionic?(Mac OSX El Capitan 10.11.2),macos,cordova,ionic-framework,npm,Macos,Cordova,Ionic Framework,Npm,我正在尝试使用npm在我的mac上安装Ionic,运行OSX El Capitan 10.11.2。 sudo npm install -g cordova ionic Cordova已经安装,我肯定正确输入了密码。以下是错误消息和日志: Last login: Sun May 1 18:41:17 on ttys001 egaumbp:~ gg$ sudo npm install -g cordova ionic Password: /usr/local/bin/cordova ->
sudo npm install -g cordova ionic
Cordova已经安装,我肯定正确输入了密码。以下是错误消息和日志:
Last login: Sun May 1 18:41:17 on ttys001
egaumbp:~ gg$ sudo npm install -g cordova ionic
Password:
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic
> node-sass@3.4.2 install /usr/local/lib/node_modules/ionic/node_modules/node-sass
> node scripts/install.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
path.js:424
var path = (i >= 0) ? arguments[i] : process.cwd();
^
Error: EACCES: permission denied, uv_cwd
at Error (native)
at Object.posix.resolve (path.js:424:50)
at startup (node.js:96:32)
at node.js:968:3
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! node-sass@3.4.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.4.2 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls node-sass
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/gg/npm-debug.log
egaumbp:~ gg$
有解决方案吗?如果您在安装Ionic时遇到问题,您可能需要查看我写的关于安装Ionic的文章: 以下是文章摘要: 前提条件:必须安装npm。您可以通过输入以下命令进行检查:“npm-v”。这将为您提供版本号。如果没有,请安装它们 现在让我们来解决这个问题 首先启动此命令:
sudo npm安装--全局--不安全的perm quickscrape
然后,启动此命令:
sudo npm安装-g cordova-ionic——不安全的perm quickscrape
现在,运行以下命令:
sudo npm安装-g-ionic——不安全的perm节点sass
一旦我这样做了,爱奥尼亚的工作非常出色。这是在运行OSX El Capitan 10.11.2的MacBook Pro(视网膜,13英寸,2012年底)上完成的。
我不确定Windows用户是否对此有任何问题,但我认为如果您在Windows上执行此操作,则应该删除“sudo”
现在您已经按照我的步骤进行了操作,Ionic和Cordova都应该安装并正常工作。首先创建一个空白的Ionic项目:
ionic start myApp blank
不知道什么是“quickscrape”(在公认的答案中),但解决方案更简单,对我来说也更有效:
sudo chown -R $USER /usr/local/
然后再也不要在npm中使用sudo了。我也有同样的功能problem@ThomasBredillet我自己找到了解决办法。请检查我下面的答案。@ThomasBredillet我在上发表了这篇文章。