Vue-cli: Failed at `npm run dev`

Created on 9 Jan 2018  ·  22Comments  ·  Source: vuejs/vue-cli

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

> [email protected] 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! [email protected] dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
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!     /Users/ajhsu/.npm/_logs/2018-01-09T09_28_10_300Z-debug.log

It seems caused by a known issue on [email protected]. 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".

Most helpful comment

yarn remove webpack-dev-server
yarn add [email protected] --dev
yarn run dev

OK!

All 22 comments

+1

++++++11111111111111111111111111

yarn remove webpack-dev-server
yarn add [email protected] --dev
yarn run dev

OK!

Yeah, it is a webpack 2.9.10 issue. Downgrading this will help.

@axtho Actually there has no [email protected], it's the problem of [email protected]. 😄

Right. That is correct.

yarn remove webpack-dev-server
yarn add [email protected] --dev
yarn run dev

亲测可以

2.10.1 should fix it too.

2.11.0无此Bug

'cross-env' 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: cross-env NODE_ENV=development webpack-dev-server --open --hot
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.

hi I still encounter this even after changing the webpack-dev-server to ^2.9.7

i just install vue-cli and this is my package json

{
"name": "my-app",
"description": "A Vue.js project",
"version": "1.0.0",
"author": "",
"license": "MIT",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"vue": "^2.5.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.7"
}
}

how do i fix this?

@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.

change the config >index.js port: 8080 to other port eg, port: 8081

npm uninstall webpack-dev-server
npm install [email protected] --dev
npm run serve

It works perfectly!💝

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

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

Same. --unsafe-perm seemed. to fix.

npm remove webpack-dev-server
npm add [email protected] --dev
nmp run dev

this solves the whole problem

thank you, it works for me

help me

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

npm add [email protected] --dev

thank you it works

On Sun, Apr 7, 2019 at 10:24 AM mohammad nazari notifications@github.com
wrote:

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

npm add [email protected] --dev


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/vuejs/vue-cli/issues/714#issuecomment-480573779, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AIHb5FEHLCXEK19MhwzPamRu3E6DSHd_ks5vebldgaJpZM4RXkL_
.

okee ^^

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: webpack-dev-server --inline --progress --config build/webpack.dev.conf.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! /Users/uroo/.npm/_logs/2020-06-17T07_32_00_033Z-debug.log

cannot run node project suddenly

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jgribonvald picture jgribonvald  ·  3Comments

BusyHe picture BusyHe  ·  3Comments

csakis picture csakis  ·  3Comments

JIANGYUJING1995 picture JIANGYUJING1995  ·  3Comments

Akryum picture Akryum  ·  3Comments