【问题标题】:execute package.json script执行 package.json 脚本
【发布时间】:2020-10-04 16:53:10
【问题描述】:

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 就可以了。

【问题讨论】:

  • npm run watch-sass 工作吗?
  • 是的工作,然后我不知道为什么npm start 工作没有运行
  • 更多详情请参考我的回答:)

标签: npm sass


【解决方案1】:

使用

npm run watch-sass

npm start 起作用的原因是因为 npm testnpm startnpm restartnpm stop 都是 npm run xxx 的别名。因为watch-sass 不属于默认值,所以它需要在语句中显式地run

更多详情请访问:https://docs.npmjs.com/cli/run-script

【讨论】:

    猜你喜欢
    • 2016-06-02
    • 2018-03-03
    • 1970-01-01
    • 1970-01-01
    • 2021-09-14
    • 2020-12-04
    • 2021-09-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多