3

我來yeoman和角開始使用該命令,但我拋出這個錯誤,我可以做什麼?錯誤:EACCES,在命令#yo角度被拒絕的權限

#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) 
+1

也許使用'sudo'命令能夠解決您的問題 – 2014-09-20 06:38:05

回答

11

前綴與sudo您的命令將解決您的問題,但它僅僅是一個快速的解決方法。 另一個解決方法是將此目錄的權限設置給您的用戶。例如

sudo chown $YOUR_USER -R /usr/lib/node_modules 

但是,最好的辦法是跟隨偉大的意見以下gist

+0

感謝您的鏈接。 – Dejan 2015-09-03 19:21:22

+0

感謝那個sudo – Steve 2018-02-14 13:20:46

0

使用以下命令

sudo chown -R $Your_User:$Your_Group /usr/lib/node_modules

相關問題