"npm run dev" Command Doesn't Work - Giving "missing script: dev" error

Viewed 9087

I was trying to run this SVELT GitHub repo on local server:

https://github.com/fusioncharts/svelte-fusioncharts

I tried to launch it with "npm run dev" command. But I am seeing this error:

npm ERR! missing script: dev

I have tried to fix the issue by setting 'ignore-scripts' to false with this command:

npm config set ignore-scripts false

But it doesn't work.

How can I fix the issue?

5 Answers

npm ERR! missing script: dev means you are there isn't a script having dev. You are likely running on an incorrect directory.

Fusion charts seem to work with svelte codesandbox.

npm ERR! missing script: dev means it cannot find a script called dev inside package.json.

That makes sense!

It looks at the package.json inside the svelte-fusioncharts repo. In that file, there is a scripts property.

Notice how that property looks as follows:

"scripts": {
  "build": "rollup -c",
  "prepublishOnly": "npm run build"
}

It does not contain a dev script. That’s why it says there’s a missing script. Other commands will work, like npm run build or npm run prepublishOnly.

Md. Ehsanul Haque Kanan,

  "scripts": {
"build": "cross-env NODE_ENV=production webpack",
"dev": "webpack-dev-server --content-base public" }

The above is the script from the examples folder in the repo: https://github.com/fusioncharts/svelte-fusioncharts/blob/develop/examples/package.json

You have missed out on the "dev" script in your package.json file.

Please check the "package.json" file in your project and just add the "dev" script as in the repo link and then retry.

Alright. I have fixed the issue. I just go inside examples folder. Then I run the following commands:

npm install
npm run dev

I had the same problem. It is due to changes in script object in package.json by me. I had installed nodemon and to run the code, I changed the script lifecycle events start and dev in package.json to run the code via nodemon. But even after installing nodemon, it was not reflecting in devDependencies, so I made manual entry in package.json with its version seeing from package-lock.json.

  "devDependencies": {
    "nodemon":"^2.0.15"
  }

Making this arrangement, my code started as expected. So, check your recent npm package installation and verify its reflection in devDependencies or dependencies in package.json.

Related