javascript - npm start runs 'webpack-dev-server' and reports an error Cannot find module 'webpack'
淡淡烟草味
淡淡烟草味 2017-05-16 13:31:41
0
2
753

Run cnpm start and run "webpack-dev-server". After running "webpack-dev-server", an error is reported: webpack is not found.
The contents of the packge.json file are as follows:

{
      "name": "test",
      "version": "1.0.0",
      "description": "",
      "main": "index.js",
      "scripts": {
        "start": "webpack-dev-server "
      },
      "author": "",
      "license": "ISC",
      "dependencies": {
        "webpack-dev-server": "^2.4.5"
      }
  }

webpack.config.js:

Run:
Error:

I installed webpack globally. I don’t know why it reports that webpack cannot be found.
But manually enter 'webpack-dev-server'
Run successfully:

Hope to know the reason

淡淡烟草味
淡淡烟草味

reply all(2)
曾经蜡笔没有小新

Try itnpm run start

黄舟

webpack.config.js里使用了webpack,所以webpackYou also need to partially install (this project) dependencies;

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!