2017-09-07 198 views
0

我只是升級我的節點到版本v6.11.3 和故宮的版本是5.4.1npm安裝錯誤「請嘗試以root用戶身份/ Administrator再次運行此命令。」

我試圖做

npm install 

或任何NPM安裝如

npm install nodemon 

並有這個問題。

npm WARN deprecated [email protected]: Please update to the latest version of pug, at time of writing that is [email protected] 
npm WARN deprecated [email protected]: Please use pug-load for [email protected]<=1.0.2. 
npm ERR! path C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json 
npm ERR! code EPERM 
npm ERR! errno -4048 
npm ERR! syscall unlink 
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json' 
npm ERR!  at Error (native) 
npm ERR! { Error: EPERM: operation not permitted, unlink 'C:\Users\project\node_modules\fsevents\node_modules\aws-sign2\package.json' 
npm ERR!  at Error (native) 
npm ERR! stack: 'Error: EPERM: operation not permitted, unlink \'C:\\Users\\project\\node_modules\\fsevents\\node_modules\\aws-sign2\\package.json\'\n at Error (native)', 

npm ERR! errno: -4048, 
npm ERR! code: 'EPERM', 
npm ERR! syscall: 'unlink', 
npm ERR! path: 'C:\\Users\\project\\node_modules\\fsevents\\node_modules\\aws-sign2\\package.json' } 
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!  C:\Program\_logs\2017-09-07T21_55_47_482Z-debug.log 

我一直在google搜索和嘗試了很多不同的方法,如

npm cache clean 

,但有這個問題

npm ERR! As of [email protected], the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' 
instead. 
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force. 

npm ERR! A complete log of this run can be found in: 
npm ERR!  C:\Program\_logs\2017-09-07T22_03_49_893Z-debug.log 

我不知道我怎麼能解決這個問題,並能運行我的nodemon而不是nodemon bin/www

+0

嘗試打開CMD爲管理和運行命令 – JohnnyAW

+0

如果在UNIX系統上:'須藤NPM安裝' – fdelia

回答

0

您可能已經將原始節點安裝作爲n管理員。所以現在管理員擁有全球node_modules目錄。

在Windows

  • 右鍵單擊cmdpowershell應用
  • 選擇打開爲管理員
  • 嘗試運行npm install特定命令窗口

在OSX或Linux中,使用sudo

sudo npm install 
+0

我做你所描述的,但仍然有同樣的問題。我想知道是否因爲fsevents – Tenz

1

我今天有完全一樣的問題。然後我裝紗

npm install -g yarn 

然後跑到

yarn install 

這給我講了:

info [email protected]: The platform "win32" is incompatible with this module. 
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. 

所以紗線是能夠處理,它爲我工作。

+0

我認爲問題是npm版本。我想通過回敬以前的5.2.0版本的npm版本,並且它再次運行。 – Tenz

5

嘗試使用- 不可選安裝任何包時。這對我有效。
npm install nodemon --no-optional

相關問題