安装angular-cli时出错

时间:2016-10-20 03:49:01

标签: angular-cli

我有最新版本的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 个答案:

答案 0 :(得分:4)

卸载软件包首先解决了问题:

npm uninstall -g angular-cli
npm install -g angular-cli

答案 1 :(得分:1)

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

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

答案 2 :(得分:0)

我已经按照以下步骤解决了这些错误。

  1. 第一步也是最重要的一步,在管理员模式下打开命令提示符。原因,我之所以说这很重要,是因为有时由于系统中可用的文件读写许可权而导致文件读写异常中止。
  2. 如果您已经安装了某些@ angular / cli,请通过以下方式将其卸载

    npm卸载-g angular-cli

  3. 将npm缓存清理为

  

npm缓存清理

  1. 然后尝试安装为

    npm install -g @ angular / cli @ latest

相关问题