npm 报错 Class extends value undefined is not a constructor or null
安装nodejs后执行npm -v 报错:
TypeError: Class extends value undefined is not a constructor or null
at Object.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\agent.js:114:44)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\socks-proxy-agent\dist\index.js:5:33)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (D:\Program Files\nodejs\node_modules\npm\node_modules\make-fetch-happen\lib\agent.js:169:25)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
检查环境变量中的npm,执行path指令:
查看路径发现npm不存在,将其修改为nodejs安装目录下的npm:
重新打开命令行执行npm -v:
本文作者:三点一圆
本文链接:https://www.cnblogs.com/sandianyiyuan/p/16694030.html
版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步