我之前是node20版本,然后降低版本node6.11.用nvm
C:\Windows\system32>nvm use 6.11.0
Now using node v6.11.0 (64-bit)
错误
npm -v
module.js:471
throw err;
^
Error: Cannot find module 'node:path'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\nodejs\node_global\node_modules\npm\lib\cli.js:2:39)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
我是直接去idea中的配置界面这里删除之前的npm版本,才不报错。
其他人的方法:
https://blog.csdn.net/fz250052/article/details/138506742
https://blog.csdn.net/weixin_46631078/article/details/138239138?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Ctr-4-138239138-blog-138506742.235^v43^pc_blog_bottom_relevance_base7&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2~default~CTRLIST~Ctr-4-138239138-blog-138506742.235^v43^pc_blog_bottom_relevance_base7