2017-07-26 169 views
0

當我嘗試安裝通過NPM角,我收到此錯誤信息:角2/4 NPM安裝問題

NPM安裝-g @角/ CLI

npm ERR! path C:\Users\myname\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\acorn 
npm ERR! code ENOENT 
npm ERR! errno -4058 
npm ERR! syscall rename 
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\myname\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\acorn' -> 'C:\Users\myname\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\.acorn.DELETE' 
npm ERR! enoent This is related to npm not being able to find a file. 
npm ERR! enoent 

npm ERR! A complete log of this run can be found in: 
npm ERR!  C:\Users\myname\AppData\Roaming\npm-cache\_logs\2017-07-26T15_20_28_022Z-debug.log 

當前設置:

節點-v v6.11.1

NPM -v 5.3.0

+0

我建議重新安裝節點,NPM 然後再試 – Rakeschand

+0

並且還重新安裝後,一旦重新啓動機器。一個問題:你在哪裏運行這個命令(在哪條路徑上)? – SKSpall

+0

貌似windoze ...嘗試從eleveted(管理員)運行命令提示符 – ojf

回答

1

VOILA !!我找到了答案。其實我不能說是真正解決問題的辦法,但該死的運作良好。所以我所做的是,我跑bash作爲管理員(我以前做過很多次,但沒有工作),接下來我做的:

$npm cache verify (to see what will happen after i deleted some stuff, uncompleted angular package in node_modules directory for example) 

$npm update (update all outdated local packages) 
$npm update -g (update global packages) 

$npm install -g @angular/cli 

也許布什運行以管理員身份沒有必要,也許只是NPM更新就夠了。無論如何,我希望這個解決方案對別人有幫助。