每当我尝试安装npm-registry-client时,我会收到错误“Error:Can not find module’npm-registry-client’”.
我已经尝试使用以下命令来解决这个问题,但是这不行:
npm卸载
npm install -g npm @ latest
完整的输出是:
user@pc ~/devel> npm install npm-registry-client --save module.js:340 throw err; ^ Error: Cannot find module 'npm-registry-client' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/cache/caching-client.js:9:22) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)
得到上述每个npm程序我尝试了到目前为止.更新npm后出现
解决方法
这似乎是npm@3.4.1中的错误.您应该尝试从npm@3.3.6直接升级到npm @ next,这将绕过npm的错误版本.如果你目前陷入破碎的npm,你可以通过重新安装Node.js来恢复工作的npm.
跳过此问题的最佳方法是使用正式的Node安装程序(不是Homebrew)重新安装Node,并使用打包的npm直接升级到npm @ next.
重新安装Node.js:
rm -rf /usr/local/lib/node_modules
使用Ubuntu
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash - sudo apt-get install -y nodejs
以Debian为根
curl -sL https://deb.nodesource.com/setup_5.x | bash - apt-get install -y nodejs
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。