角2/4 NPM安装问题

角2/4 NPM安装问题

问题描述:

当我尝试安装通过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

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更新就够了。无论如何,我希望这个解决方案对别人有帮助。