2016-03-08 228 views
0

我是一名初學者,我正在嘗試學習Angular,所以我正在嘗試使用angular-seed安裝一個新項目。但是,當我做npm安裝時,我得到一個錯誤,我不知道從哪裏來。我安裝了節點。版本是5.5.0。廣告這是我在控制檯中得到的錯誤。npm install時出錯

 
npm verb install Error: Unsupported 
npm verb install  at checkPlatform (/usr/lib/node_modules/npm/node_modules/npm-install-checks/index.js:46:14) 
npm verb install  at Array. (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8) 
npm verb install  at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14) 
npm verb install  at /usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7 
npm verb install  at checkEngine (/usr/lib/node_modules/npm/node_modules/npm-install-checks/index.js:25:10) 
npm verb install  at Array. (/usr/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8) 
npm verb install  at LOOP (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14) 
npm verb install  at chain (/usr/lib/node_modules/npm/node_modules/slide/lib/chain.js:20:5) 
npm verb install  at module.exports.isInstallable (/usr/lib/node_modules/npm/lib/install/validate-args.js:26:3) 
npm verb install  at resolveWithNewModule (/usr/lib/node_modules/npm/lib/install/deps.js:452:12) 
npm verb lock using /home/david/.npm/_locks/staging-7c9a6a9e85daffeb.lock for /home/david/DiabetesApp/angular-seed/node_modules/.staging 
npm verb unlock done using /home/david/.npm/_locks/staging-7c9a6a9e85daffeb.lock for /home/david/DiabetesApp/angular-seed/node_modules/.staging 
npm verb stack Error: EACCES: permission denied, mkdir '/home/david/DiabetesApp/angular-seed/node_modules/.staging' 
npm verb stack  at Error (native) 
npm verb cwd /home/david/DiabetesApp/angular-seed 
npm ERR! Linux 3.13.0-76-generic 
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "--verbose" 
npm ERR! node v5.5.0 
npm ERR! npm v3.3.12 
npm ERR! path /home/david/DiabetesApp/angular-seed/node_modules/.staging 
npm ERR! code EACCES 
npm ERR! errno -13 
npm ERR! syscall mkdir 

npm ERR! Error: EACCES: permission denied, mkdir '/home/david/DiabetesApp/angular-seed/node_modules/.staging' 
npm ERR!  at Error (native) 
npm ERR! { [Error: EACCES: permission denied, mkdir '/home/david/DiabetesApp/angular-seed/node_modules/.staging'] 
npm ERR! errno: -13, 
npm ERR! code: 'EACCES', 
npm ERR! syscall: 'mkdir', 
npm ERR! path: '/home/david/DiabetesApp/angular-seed/node_modules/.staging' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 
npm verb exit [ -13, true ] 

npm ERR! Please include the following file with any support request: 
npm ERR!  /home/david/DiabetesApp/angular-seed/npm-debug.log 
+0

使用sudo的NPM安裝 – Vanojx1

回答

0

「請嘗試以root/Administrator身份再次運行此命令。」

嘗試sudo npm install

+0

我已經嘗試過這一點。但是我在控制檯中得到了這個:無法安裝可選的依賴項:不支持的WARN生命週期[email protected]~postinstall:無法在wd%s(wd =%s)中運行[email protected] bower install/home/david/DiabetesApp/angular-seed –

+0

我在github上發現了這個問題(https://github.com/npm/npm/issues/9204)。你可以嘗試使用另一個版本的npm。 –

0

也許來不及回答,但這是一個權限問題。您必須修復此目錄的權限,並在沒有sudo的情況下運行npm install

cd your_working_directory 
sudo chown -R $(whoami):$(whoami) . 
sudo chmod -R 755 . 
npm install 
0

ISSUE:你(用戶)沒有一套正確的目錄權限。

即時解決方法是使用sudo運行npm install,但這可能會導致相同的錯誤或安裝不當。


解決方案/建議:改變故宮的默認目錄(來自官方docs

備份您的計算機前進了。

(可選)如果你有一個錯誤的安裝,先卸載它:

npm uninstall <package-name> # use sudo if you used it while installation 
npm cache verify # or, npm cache clean for npm version below 5.x.x 
  1. 建立一個目錄全球安裝:

    mkdir ~/.npm-global

  2. 配置NPM使用新的目錄路徑:

    npm config set prefix '~/.npm-global'

  3. 打開或創建一個~/.profile~/.bash_profile文件,加入這一行:

    export PATH=~/.npm-global/bin:$PATH

  4. 回到命令行上,更新系統變量,或重新啓動終端:

    source ~/.profile

  5. (可選)測試:在不使用sudo的情況下全局下載軟件包。

    npm install -g jshint