2017-07-13 31 views
0

安裝@角/ CLI當我執行命令:npm install -g @angular/cli我得到一個錯誤:無法在Linux

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules 
npm ERR! path /usr/local/lib/node_modules 
npm ERR! code EACCES 
npm ERR! errno -13 
npm ERR! syscall access 
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules' 
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules' 
npm ERR! errno: -13, 
npm ERR! code: 'EACCES', 
npm ERR! syscall: 'access', 
npm ERR! path: '/usr/local/lib/node_modules' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/my_user_name/.npm/_logs/2017-07-13T13_36_06_285Z-debug.log 

然後我試圖執行命令:sudo npm install -g @angular/cli但我得到了一個錯誤:

npm ERR! path /usr/local/bin/ng 
npm ERR! code EEXIST 
npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin 
npm ERR! File exists: /usr/local/bin/ng 
npm ERR! Move it away, and try again. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /home/my_user_name/.npm/_logs/2017-07-13T13_39_01_642Z-debug.log 

如果連sudo priviliges都不夠,我該如何安裝Angular-CLI?

+0

嘗試刪除/ usr/local/bin/ng manualy(作爲root) – TGrif

+0

我這樣做,現在我得到一個錯誤,描述爲https://github.com/angular/angular-cli/issues/6848但解決方案在我的示例中不起作用。 – user

回答

0

它看起來像寫入問題。

你有兩個選擇使用sudo(不是最好的選擇)或更改文件夾的所有者。

  1. sudo npm install -g @angular/cli
  2. sudo chown -R $USER /usr/local/lib/node_modules

檢查內容符號鏈接路徑,最終重新安裝口是心非一組權利。