简体   繁体   中英

how to fix "npm ERR! Missing script:"

I wrote the script "style", but for some reason does not want to execute it. Using the npm run command, you can just execute the script "test": "echo "Error: no test specified" && exit 1" My package.json is below, as well as the full error message when I run a command:

  {
  "name": "plants",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "style": "sass sass/style.scss sass/style.css",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

here I am trying to run a sktipt:

npm run style
npm ERR! Missing script: "style"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR!   npm run

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\GRAFIK548\AppData\Local\npm-cache\_logs\2022-12-28T06_18_17_306Z-debug-0.log

and here I look at what scripts can be run:

$ npm run
Lifecycle scripts included in plants@1.0.0:
  test
    echo "Error: no test specified" && exit 1

in general, I'm trying to connect sass via json

thank you very much for any answer!!

NPM err missing script fix


I used to get this error a lot on my old computer. The easiest fix I found that worked was to just

Try to use the absolute path of the file in your JSON.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM