Angular 2/4 npm安装问题

时间:2017-07-26 15:28:59

标签: node.js angular

当我尝试通过npm安装角度时,我收到以下错误消息:

npm install -g @ angular / 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

1 个答案:

答案 0 :(得分: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

也许没有必要以管理员身份运行bush,也许只是npm更新就足够了。无论如何,我希望这个解决方案对某人有所帮助。