vue-cli: Failed at `npm run dev`

For those people who encounter the following error messages:

$ vue init webpack-simple simple-example
$ cd simple-example
$ npm install
$ npm run dev

ajhsu-mbpr:simple-example ajhsu$ npm run dev

> simple-example@1.0.0 dev /Users/ajhsu/Git/vue/simple-example
> cross-env NODE_ENV=development webpack-dev-server --open --hot

webpack-dev-server 2.10.0
webpack 3.10.0
Usage: https://webpack.js.org/configuration/dev-server/

Config options:
  --config       Path to the config file
                         [string] [default: webpack.config.js or webpackfile.js]
  --config-name  Name of the config to use                              [string]

....

  --open-page   Open default browser with the specified page            [string]

Missing argument values: config, config-name, context, entry, module-bind, module-bind-post, module-bind-pre, output-path, output-filename, output-chunk-filename, output-source-map-filename, output-public-path, output-jsonp-function, output-library, output-library-target, records-input-path, records-output-path, records-path, define, target, watch-aggregate-timeout, devtool, resolve-alias, resolve-extensions, resolve-loader-alias, optimize-max-chunks, optimize-min-chunk-size, prefetch, provide, plugin, open-page
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! simple-example@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the simple-example@1.0.0 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!     /Users/ajhsu/.npm/_logs/2018-01-09T09_28_10_300Z-debug.log

It seems caused by a known issue on webpack-dev-server@2.10.0. While the generated vue project is requiring webpack-dev-server@^2.9.1 which may install the broken version 2.10.0 that causes the error.

You can now temporary fix it by assigning the version of webpack-dev-server to 2.9.7 in your package.json like this: "webpack-dev-server": "2.9.7".

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 20
  • Comments: 24 (1 by maintainers)

Most upvoted comments

yarn remove webpack-dev-server yarn add webpack-dev-server@2.9.1 --dev yarn run dev

OK!

@rgalaxy That’s not the problem related to this issue;

I think It’s simply because you haven’t run npm install before npm run dev or npm run build yet.

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

npm add webpack-dev-server@2.9.1 --dev

npm remove webpack-dev-server npm add webpack-dev-server@2.9.1 --dev nmp run dev

this solves the whole problem

yarn remove webpack-dev-server yarn add webpack-dev-server@2.9.1 --dev yarn run dev

亲测可以

npm uninstall webpack-dev-server npm install webpack-dev-server@2.9.1 --dev npm run serve

It works perfectly!💝

@slwzero thanks, in 2019 and it’s still failing

2.10.1 should fix it too.