Webpack - webpack-dev-server: command not found

后端 未结 11 1976
一个人的身影
一个人的身影 2020-12-22 23:29

I am working on a React webapp using webpack, loosely alongside this tutorial.

Accidentally, I added the node_modules folder to my git. I then removed it again using

11条回答
  •  盖世英雄少女心
    2020-12-22 23:58

    I had the same issue but the below steps helped me to get out of it.

    1. Installing the 'webpack-dev-server' locally (In the project directory as it was not picking from the global installation)

      npm install --save webpack-dev-server

    Can verify whether 'webpack-dev-server' folder exists inside node_modules.

    1. Running using npx for running directly

    npx webpack-dev-server --mode development --config ./webpack.dev.js

    npm run start also works fine where your entry in package.json scripts should be like the above like without npx.

提交回复
热议问题