Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
程序员文章站
2022-06-01 12:37:47
...
问题:
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
at Function.Module._resolveFilename (module.js:438:15)
at Function.Module._load (module.js:386:25)
1.卸载webpack并重装webpack
npm remove webpack -g
npm install webpack –save-dev
2.由于使用的是全局的 webpack,找不到某些目录,将全局的指向自己当前的项目即可。在项目目录执行 npm link webpack结果如下:
D:\front-stack\react-semantic>npm link webpack
D:\front-stack\react-semantic\node_modules\webpack -> C:\Users\TT_SHK\AppData\Roaming\npm\node_modules\webpack
3.第一步:npm config get prefix ,获取输出path“C:\Users\Gavin\AppData\Roaming\npm”加上"\node_modules"用于第二步值
第二步:添加系统环境变量:NODE_PATH:C:\Users\Gavin\AppData\Roaming\npm\node_modules
第三步:关掉命令行,重新打开。
网上说的,不知知道是否可行
推荐阅读
-
【已解决】运行webpack-dev-server时提示Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack5: Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Webpack 报错:Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
webpack-dev-server 报错 Error: Cannot find module ‘webpack/bin/config-yargs‘
-
webpack——Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
【webpack-dev-server】Error: Cannot find module ‘webpack-cli/bin/config-yargs‘
-
Error: Cannot find module 'webpack-cli/bin/config-yargs' at Function.Module._resolveFilename
-
【webpack】Error: Cannot find module webpack-cli/bin/config-yargs
-
Module build failed: Error: Cannot find module 'node-sass’
-
Module build failed: Error: Cannot find module 'node-sass' at Function.Module._resolveFilename (