我试图让我的节点环境设置在一个新的 Ubuntu 12.04 实例,节点 0.8.14 已经安装,当我试图运行npm install
时遇到了问题。
因此,当我尝试 npm install
时,它说我需要以根用户或管理员身份运行它:
Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules/coffee-script',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/coffee-script',
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.
但是当我以 sudo 的身份试图运行它时,提示:
npm WARN cannot run in wd PackNodeDev@0.0.1-166 npm install -g coffee-script node-gyp (wd=/home/ubuntu/PackNode)
package.json 包含如下内容:
"scripts": {
"preinstall": "npm install -g coffee-script node-gyp",
"start": "node server.js",
"test": "mocha --require should --compilers coffee:coffee-script --colors"
},
其余的 dev 依赖(开发环境依赖)都是有效的,因为我一直在我自己的机器上安装它(Mac)
有人知道为什么会这样吗?< / p >