我已经看到其他帖子用 Curl 解决了这个问题——但是还有其他方法来解决这个问题吗?发生了什么?
我在使用最新的 Node.js(不是 lts)时遇到了一些问题,我尝试卸载 Node(使用控制面板),然后重新安装 LTS 版本。
安装后,我在任何 npm 命令上都会收到这些错误:
C:\Windows\System32>npm -v
module.js:549
throw err;
^
Error: Cannot find module 'proto-list'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\jle01\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:1:79)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
最佳答案
首先确保 Node 已完全删除:
取自 How to completely remove node.js from Windows
如何从 Windows 中删除 Node.js:
深呼吸。
使用卸载程序从程序和功能中卸载。
重新启动(或者您可能可以从任务管理器中终止所有与 Node 相关的进程)。
查找这些文件夹并删除它们(及其内容)(如果仍然存在)。根据您安装的版本、UAC 设置和 CPU 架构,这些可能存在也可能不存在:
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users{User}\AppData\Roaming\npm(或%appdata%\npm)
C:\Users{User}\AppData\Roaming\npm-cache(或 %appdata%\npm-cache)
C:\Users{User}.npmrc (也可能检查是否没有 . 前缀)
C:\Users{用户}\AppData\Local\Temp\npm-*
检查您的 %PATH% 环境变量,确保不存在对 Nodejs 或 npm 的引用。
- 如果仍未卸载,请在命令提示符下键入 where node,您将看到它所在的位置 - 也删除它(可能还包括父目录)。
重新启动,以达到良好的效果。
现在重新安装。
关于node.js - npm 损坏 : cannot find module 'proto-list' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51449254/