I'm having some issue with my project, when I run webpack-dev-server
command, it show me not found, even I've installed twice webpack-dev-server!
Thanks!
I'm having some issue with my project, when I run webpack-dev-server
command, it show me not found, even I've installed twice webpack-dev-server!
Thanks!
First of all, you have installed webpack
, webpack-cli
and webpack-dev-server
the wrong way. You made them dependencies
and not devDependencies
. To change that, uninstall them:
npm uninstall webpack webpack-cli webpack-dev-server
and then install them properly:
npm install webpack webpack-cli webpack-dev-server --save-dev
Now, webpack-dev-server
is in your node_modules
folder. You can either run it from your terminal with
node node_modules/webpack-dev-server/bin/webpack-dev-server.js
or (as @nickbullock said), add a script in your package.json
file and execute it from your terminal.
webpack dev-server is not installed globally. please add it your scripts section in package.json
"scripts": {
"dev-server": "webpack-dev-server"
}
and then run it from console:
npm run dev-server
Also you can install it globally:
npm install -g webpack-dev-server
then you can run webpack-dev-server
command on any project without local installation and adding to the scripts.
If you have global and local webpack-dev-server and using it with scripts, local version will be used.