fanhualuojin154873
fanhualuojin154873

Reputation: 541

In Vue-CLI run dev, fail.

In the vue-cli, I want to npm run dev, but get the bellow error:

$ npm run dev

> vuejs-playlist@1.0.0 dev /Users/den/Desktop/Test/vue/vuejs-playlist
> cross-env NODE_ENV=development webpack-dev-server --open --hot

sh: cross-env: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! vuejs-playlist@1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the vuejs-playlist@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/den/.npm/_logs/2018-02-02T11_54_11_067Z-debug.log

Upvotes: 0

Views: 1980

Answers (3)

Jack Bou3r
Jack Bou3r

Reputation: 11

As both answers before stated your build failed due needing to first:

npm install

Once that is complete, check your package.json file.

In there will have the default options for npm run followed by your build script option.

Example:

{
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build"
  }
}

Resulting in your npm run serve is the same as vue-cli-service serve

Reference: Vue Docs

Upvotes: 0

Bablu Ahmed
Bablu Ahmed

Reputation: 5020

Try as follows for @vue/cli

npm run serve

Upvotes: 2

aircraft
aircraft

Reputation: 26924

In your traceback:

Local package.json exists, but node_modules missing, did you mean to install?

You should in your project root directory install the dependencies:

npm install 

Or use its logogram npm i

Upvotes: 1

Related Questions