af1223345
af1223345

Reputation: 45

execute package.json script

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"
  },

There is no problem when I execute npm-start but not npm watch-sass. I don't know what is wrong but the command is not recognized, I type sass --watch scss/styles.scss css/styles.css directly on the console and it works.

Upvotes: 0

Views: 174

Answers (1)

myselfmiqdad
myselfmiqdad

Reputation: 2606

use

npm run watch-sass

The reason npm start works is because npm test, npm start, npm restart, and npm stop are all aliases for npm run xxx. Because watch-sass does not fall in the defaults, it requires an explicit run in the statement

For more details visit: https://docs.npmjs.com/cli/run-script

Upvotes: 1

Related Questions