javascript – 错误:EACCES,命令#yo angular中的权限被拒绝
作者:互联网
我来自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)
解决方法:
使用sudo命令前缀将解决您的问题,但这只是一个快速的解决方法.
另一种解决方法是将此目录的权限设置为您的用户.例如
sudo chown $YOUR_USER -R /usr/lib/node_modules
但最好的方法是遵循以下gist的伟大建议
标签:javascript,node-js,yeoman,yeoman-generator,yeoman-generator-angular 来源: https://codeday.me/bug/20190716/1476943.html