LoginSignup
0
0

More than 3 years have passed since last update.

webpack cliのmodule not foundが原因で、webpack-dev-serverが実行できない問題を解決

Last updated at Posted at 2021-04-17

package.json内の記述

  "scripts": {
    "start": "webpack-dev-server --mode=development"
  }

実際にnpm startしてみると、

 code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/ts-todo/node_modules/webpack-dev-server/bin/webpack-dev-server.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ts-todo@1.0.0 start: `webpack-dev-server --mode=development`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ts-todo@1.0.0 start 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!     /Users/.npm/_logs/2021-04-17T01_19_22_961Z-debug.log

原因

webpacker cliのバージョンが4だと、何やら問題があるらしい。
https://github.com/webpack/webpack-dev-server/issues/2029

バージョンを下げてみる

package.json
"webpack-cli": "^3.1.8",

npm installで変更を反映させて、npm startを実行すると、無事通った。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0