1
我试图用npm install -g PACKAGE_NAME安装一个软件包,但它抛出了以下错误。npm安装在ubuntu中抛出错误
npm http GET https://registry.npmjs.org/ionic
npm http 304 https://registry.npmjs.org/ionic
npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/local/lib/node_modules',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/ionic',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/lib/nodejs/fstream/lib/writer.js:171:23',
npm ERR! '/usr/lib/nodejs/mkdirp/index.js:37:53',
npm ERR! 'Object.oncomplete (fs.js:107:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
此外,当我尝试sudo npm install -g PACKAGE_NAME时,它默默执行,但未安装该软件包。
$ sudo npm install -g ionic
npm http GET https://registry.npmjs.org/ionic
npm http 304 https://registry.npmjs.org/ionic
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic
[email protected] /usr/local/lib/node_modules/ionic
[email protected]:~/songhop/self$ ionic
/usr/bin/env: node: No such file or directory
而且正如在堆栈溢出回答说我已经放弃使用sudo chown -R $USER node_modules
在node_module目录的写入权限。
也许你在这里找到解决方案:http://stackoverflow.com/questions/31041366/how-to-install-ionic-framework-on-ubuntu –