【发布时间】:2017-10-20 19:43:09
【问题描述】:
如何修复 npm 更新错误?我以 root 身份运行
# npm install npm@latest -g
usr/lib
└── (empty)
npm ERR! Linux 4.10.14-200.fc25.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "npm@latest" "-g"
npm ERR! node v6.10.2
npm ERR! npm v3.10.10
npm ERR! path /usr/lib/node_modules/npm/node_modules/node-gyp
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall mkdir
npm ERR! EEXIST: file already exists, mkdir '/usr/lib/node_modules/npm/node_modules/node-gyp'
npm ERR! File exists: /usr/lib/node_modules/npm/node_modules/node-gyp
npm ERR! Move it away, and try again.
npm ERR! Please include the following file with any support request:
npm ERR! /root/npm-debug.log
npm ERR! code 1
最终没有 npm。
日志文件位于https://www.dropbox.com/s/2maxolbxjlnnp7c/npm-debug_error.log.txt?dl=0
我的节点版本是6.10.2,使用fedora core 25 64bits。 npm 版本是 3.10.10
我还在https://github.com/npm/registry/issues/168上创建了一个问题
现在,npm 没有安装:
npm
-bash: /usr/bin/npm: 没有那个文件或目录
我明天关注https://github.com/brock/node-reinstall,如果没有找到其他建议,尝试卸载并重新安装完整节点。
我运行这个 npm 更新,因为它是在聚合物 2.0 中安装 polymer-cli 的建议的第一步
【问题讨论】:
-
为什么不尝试使用
npm update npm? -
请不要以root用户身份运行它!
-
我运行这个命令,因为它是安装 polymer2 的第一个建议步骤。检查polymer-project.org/2.0/docs/tools/polymer-cli
-
我在过去看到一个非常相似的错误 (github.com/npm/npm/issues/898) 已关闭