Error: Cannot find module 'F:\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function._resolveFilename (node:internal/modules/cjs/loader:1249:15) at Function._load (node:internal/modules/cjs/loader:1075:27) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:218:24) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5) at node:internal/main/run_main_module:36:49 { code: 'MODULE_NOT_FOUND', requireStack: [] }
我按照文件夹路径发现确实没有这个路径,网上的解决也是鱼龙混杂。
所以当时的我最后是这样解决的。
我的解决是:
卸载,然后不通过msi安装
而是下载压缩包,网站Node.js — Download Node.js®
然后解压,我是解压到F盘。
最后自己设置环境变量
这两个文件夹环境设置好了,就解决了。