NPM不再工作
NPM no longer working
所以我没有注意,运行了这个命令-
npm install npm install jasmine-node -g
导致这个-
npm http GET https://registry.npmjs.org/install
npm http GET https://registry.npmjs.org/jasmine-node
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/install
npm http GET https://registry.npmjs.org/install/-/install-0.1.7.tgz
npm http 200 https://registry.npmjs.org/install/-/install-0.1.7.tgz
npm http 200 https://registry.npmjs.org/jasmine-node
npm http GET https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.4.0.tgz
npm http 200 https://registry.npmjs.org/jasmine-node/-/jasmine-node-1.4.0.tgz
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-1.2.15.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.2.15.tgz
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/install'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/install']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/install',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/install',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ 'DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:297:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! path /usr/local/lib/node_modules/install
npm ERR! fstream_path /usr/local/lib/node_modules/install
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/install'
npm ERR! fstream_stack DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/jasmine-node',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/jasmine-node',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ 'DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:297:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! path /usr/local/lib/node_modules/jasmine-node
npm ERR! fstream_path /usr/local/lib/node_modules/jasmine-node
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/local/lib/node_modules/jasmine-node'
npm ERR! fstream_stack DirWriter._create (/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23)
npm ERR! fstream_stack /usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm@1.2.15 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/local/lib/node_modules/npm' }
npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "npm" "install" "jasmine-node" "-g"
npm ERR! cwd /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn
npm ERR! node -v v0.8.17
npm ERR! npm -v 1.2.0
npm ERR! path /usr/local/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/psanker/Google Drive/Coding/Javascript/WhatsGoingOn/npm-debug.log
npm ERR! not ok code 0
现在当我试着运行
npm install jasmine-node -g
我得到
-bash: /usr/local/bin/npm: No such file or directory
怎么回事?
当你运行npm install -g somepackage时,你可能会得到一个EACCES错误,要求你以root/Administrator身份再次运行该命令。这是一个权限问题。
很容易修复,打开你的终端(应用程序>工具>终端)sudo chown -R $USER /usr/local
**我强烈建议你不要使用sudo的包管理(sudo npm -g install something),因为你以后可能会遇到一些问题**
参考:http://foohack.com/2010/08/intro-to-npm/
** Update **
原因是这可能会导致许多其他应用程序的权限问题,所以我建议不要这样做。
全局安装时更好的解决方案:
sudo chown -R `whoami` ~/.npm
我自己试过了。
您将需要再次安装npm
。如果您使用git
,这是最简单的方法:
git clone http://github.com/isaacs/npm.git
cd npm
sudo make install
否则,也有一个安装脚本:
curl http://npmjs.org/install.sh | sh
(可能您需要使用sudo sh
而不是sh
)。
然后重新安装你的模块:
sudo npm install jasmine-node -g
编辑23/01/2014:
查看错误
Please try running this command again as root/Administrator.
您需要使用sudo
$ sudo npm install jasmine-node -g
这对我(OSX)有效。我必须在我的用户目录下运行它。
cd ~
curl -L http://npmjs.org/install.sh | sudo sh
我可以通过一行"$HOME/"将我的包设置为本地安装来解决权限问题。npmrc"文件:
前缀= ${回家}/.npm_packages
相关文章:
- Firebase迁移-简单的Firebase.set没有'不再工作了——旧的还是新的
- 当我更改innerHtml时,引导选项卡事件不再工作
- 天气应用 API 不再工作
- AngularJS Dropdown在使用指令后不再工作
- 虚拟键盘在更新到 Chrome v50 后不再工作
- $(这个)没有't在onClick事件中不再工作
- 当控制台不在't在chrome中打开,有些项目不再可点击(有些js调用停止工作)
- 升级至Knockout 3.0.0,Templates/Custom Binding Handlers不再工作
- 自定义绑定在KnockoutJS 3.0中不再工作
- 为什么不是'我的jQuery不再工作了
- .replace() 不再为我工作
- 为什么 ngClick 在$compile后不再工作
- AngularJs 路由不再工作.地址栏更改,但视图不会更改
- yam.platform.setAuthToken在IE 8和IE 9中不再工作
- 节点.js版本已更改,脚本不再工作
- 是 ngAnimate 不再工作了
- .click() 不再工作 jquery.
- JS点击功能不再工作以更改链接颜色
- 谷歌地图API不再工作
- 事件处理程序在 html 重新呈现后不再工作