我来了 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 - 命令中错误 : EACCES, 权限被拒绝#yo angular,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25945447/