安装angular-cli时出现错误

3

我有最新版本的Node和npm:

> npm -v
3.10.8
> node -v
v4.6.1

安装angular-cli时出现此问题。

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Misha\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v4.6.1
npm ERR! npm  v3.10.8
npm ERR! path C:\Users\Misha\AppData\Roaming\npm\node_modules\.staging\abbrev-9f02c1d4
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Mishap\AppData\Roaming\npm\node_modules\.staging\abbrev-9f02c1d4' -> 'C:\Users\Mishap\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\abbrev'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Mishap\AppData\Roaming\npm\node_modules\.staging\abbrev-9f02c1d4' -> 'C:\Users\Mishap\AppData\Roaming\npm\node_modules\angular-cli\node_modules\npm\node_modules\abbrev'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

有什么想法吗?

3个回答

4
首先卸载该软件包可以解决问题:
npm uninstall -g angular-cli
npm install -g angular-cli

1

更新您的节点,然后以管理员身份运行命令提示符,并尝试以下操作:

npm install -g angular-cli@1.0.0-beta.18

0

我通过以下步骤解决了这些错误。

  1. 首先,非常重要的一步是以管理员模式打开命令提示符。为什么我说这很重要呢?因为有时候由于系统中文件读写权限的限制,通常会导致读写文件失败。
  2. 如果您已经安装了一些 @angular/cli,请使用以下命令卸载:

    npm uninstall -g angular-cli

  3. 清除 npm 缓存:

npm cache clean

  1. 然后尝试安装:

    npm install -g @angular/cli@latest


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接