I try to create a full stack environment with Django + ReactJS. Here, I use Webpack bundler and I'm getting this error while I try to run my webpack-server from a virtualenv
. I'm very new to the application development and this is my first attempt, So can anyone help me out?
PS C:\Users\NikhileshSubramanian\Desktop\eduWebApp\env\frontend> npm run dev
frontend@0.1.0 dev C:\\Users\\NikhileshSubramanian\\Desktop\\eduWebApp\\env\\frontend webpack-dev-server module.js:549 throw err; ^
Error: Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
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 (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\NikhileshSubramanian\node_modules\html-webpack-plugin\lib\compiler.js:9:28)
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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 dev: `webpack-dev-server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\NikhileshSubramanian\AppData\Roaming\npm-
cache\_logs\2018-09-29T07_48_56_942Z-debug.log
Scripts inside my package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"buildwebpack": "webpack",
"dev": "webpack-dev-server"
},
"devDependencies": {
"webpack": "^4.20.2",
"webpack-cli": "^3.1.1",
"webpack-dev-server": "^3.1.9"
}
Project Working Directory https://i.stack.imgur.com/z1v0p.png
I saw that you are using windows system.So maybe you need configure environment variables for this "webpack/lib/node/NodeTemplatePlugin" module. Then it can find the module.
Webpack is inbuilt in React modules when we create a project via create-react-app
. That's how Facebook has developed to reduce concentrating about environment setup and look into building the application. So, there's an easy way to create our project avoiding Webpack initiation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.