thrown error: cannot find module 'webpack/lib/NormalModule' when building
Opened this issue · 1 comments
Expected Behavior
build successfully.
Actual Behavior
building failed. error is reported below
Is an error being thrown?
Error: Cannot find module 'webpack/lib/NormalModule'
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 (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-
cli\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object. (D:\svn\jhtmp\node_modules\hard-source-webpack-plugin
lib\TransformNormalModulePlugin.js:1:84)
at Module._compile (C:\Users\Administrator\AppData\Roaming\npm\node_modules
webpack-cli\node_modules\v8-compile-cache\v8-compile-cache.js:192: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)
at Module.require (module.js:596:17)
at require (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-
cli\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at HardSourceWebpackPlugin.apply (D:\svn\jhtmp\node_modules\hard-source-webp
ack-plugin\index.js:430:41)
at webpack (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack
lib\webpack.js:51:13)
at processOptions (C:\Users\Administrator\AppData\Roaming\npm\node_modules\w
ebpack-cli\bin\cli.js:272:16)
at yargs.parse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\webp
ack-cli\bin\cli.js:364:3)
at Object.parse (C:\Users\Administrator\AppData\Roaming\npm\node_modules\web
pack-cli\node_modules\yargs\yargs.js:567:18)
at C:\Users\Administrator\AppData\Roaming\npm\node_modules\webpack-cli\bin\c
li.js:49:8
at Object. (C:\Users\Administrator\AppData\Roaming\npm\node_modul
es\webpack-cli\bin\cli.js:366:3)
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)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\Administrator\AppData\Roaming\npm\node_modul
es\webpack\bin\webpack.js:156:2)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
Steps to Reproduce
- In my webpack.config.js:
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
module.exports = {
entry: ...,
output: ...,
module: ...,
plugins: [
new HardSourceWebpackPlugin()
]
};
- Any other information you find helpful reproducing an issue
I use 'webpack --mode development' to build.
Operating System, Node, and NPM dependency versions
windows 7
Node 8.11.4
npm 6.4.0
"devDependencies": {
"babel-core": "^7.9.0",
"babel-loader": "^8.1.0",
"babel-preset-env": "^7.9.5",
"css-loader": "^3.5.1",
"style-loader": "^1.1.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11",
"hard-source-webpack-plugin": "^0.13.1"
},
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
}
+1