Search code examples
npmsasspackage.jsonnpm-scripts

NPM Script only works if I run it in two terminals at the same time or in debug


I'm trying to run the command (On Windows using VS): npm run watch:sass to compile my sass into css.

When I hit enter instead of seeing the regular message about watching for changes it will just show the command I just entered and no errors or anything. But here is the thing: If I open a second terminal window it will run the command in the second terminal window but only if I always use two terminal windows.

Below are my package.json bits for this:

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "watch:sass": "sass --watch --update --style=compressed src/sass/Navbar.scss src/styles/index.css",
    "watch": "npm-run-all --parallel watch:*"
  },
  "devDependencies": {
    "autoprefixer": "^10.4.4",
    "npm-run-all": "^4.1.5",
    "onchange": "^7.1.0",
    "postcss": "^8.4.12",
    "sass": "^1.51.0",
    "watch": "^1.0.2"
  }

Solution

  • Seems to be a known bug. Will update this if anything changes