package.json
:
"scripts": {
"start": "nodemon index.js",
"watch-sass": "sass --watch scss/styles.scss css/styles.css",
"test": "echo \"Error: no test specified\" && exit 1"
},
执行npm-start
而不执行npm watch-sass
时没有问题。我不知道出了什么问题,但是命令无法识别,我直接在控制台上输入sass --watch scss/styles.scss css/styles.css
,它可以正常工作。
答案 0 :(得分:1)
使用
npm run watch-sass
npm start
起作用的原因是
npm test
,npm start
,npm restart
和npm stop
都是npm run xxx
的别名。由于watch-sass
不属于默认值,因此需要在语句中使用明确的run
有关更多详细信息,请访问:https://docs.npmjs.com/cli/run-script