Search code examples
npmwebpackvisual-studio-codewebpack-dev-server

'webpack-dev-server' is not recognized as an internal or external command,


I cloned this Webpack Starter package through github using gitbash following a tutorial on pluralsight. I am trying to access webpack through Visual Studio Code's integrated terminal but i get the following error. I am new to this so kindly help me on this.

I am running a command

 Raza Zaidi@RazaZaidi-PC MINGW64 ~/webpack-starter (master)
$ npm run dev

and then following error occurs

> [email protected] dev C:\Users\Raza Zaidi\webpack-starter
> webpack-dev-server --open --config webpack/webpack.config.dev.js

'webpack-dev-server' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `webpack-dev-server --open --config webpack/webpack.config.dev.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\Raza Zaidi\AppData\Roaming\npm-cache\_logs\2018-08-14T20_16_29_017Z-debug.log

Solution

  • running

    npm install -g webpack-dev-server

    in cmd as an administrator solved my problem. I hope it helps others.