我来自yeoman和angular开始使用那个命令,但我抛出了这个错误,我能做什么?
#yo angular
/usr/lib/node_modules/yo/node_modules/update-notifier/node_modules/configstore/node_modules/graceful-fs/polyfills.js:8
cwd = origCwd.call(process)
^
Error: EACCES, permission denied
at process.cwd (/usr/lib/node_modules/yo/node_modules/update-notifier/node_modules/configstore/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/insight/node_modules/configstore/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/download/node_modules/decompress/node_modules/decompress-tar/node_modules/tar/node_modules/fstream/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/download/node_modules/decompress/node_modules/decompress-tarbz2/node_modules/tar/node_modules/fstream/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/download/node_modules/decompress/node_modules/decompress-targz/node_modules/tar/node_modules/fstream/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/download/node_modules/decompress/node_modules/decompress-unzip/node_modules/temp-write/node_modules/graceful-fs/polyfills.js:8:19)
at process.cwd (/usr/lib/node_modules/yo/node_modules/yeoman-generator/node_modules/glob/node_modules/graceful-fs/polyfills.js:8:19)
at new Environment (/usr/lib/node_modules/yo/node_modules/yeoman-generator/lib/env/index.js:45:42)
at createEnv (/usr/lib/node_modules/yo/node_modules/yeoman-generator/index.js:38:10)
at init (/usr/lib/node_modules/yo/cli.js:71:40)
答案 0 :(得分:11)
使用sudo
添加命令将解决您的问题,但这只是一个快速的解决方法。
另一种解决方法是将此目录的权限设置为您的用户。例如
sudo chown $YOUR_USER -R /usr/lib/node_modules
但最好的方法是遵循以下gist的好建议
答案 1 :(得分:0)
使用以下命令
sudo chown -R $ Your_User:$ Your_Group / usr / lib / node_modules