Ignore errors when running npm scripts sequentially

Give this a shot:

npm run build:local ; npm run build:webpack && npm run serve

I think of && as meaning "only run this next command if the last one doesn't error." And ; as meaning "run this next command no matter what happens to the last one." There is also ||, which means "run the next command only if the last one errors." That's handy for things like npm run build:local || echo "The build failed!"

You can also do the following if you install npm-run-all

npm-run-all -s -c build:local build:webpack serve
  • -s run as sequence
  • -c continue on error

You can go for

npm run build:local; npm run build:webpack; npm run serve

You can read more why that works here


You can also do this in bash:

(npm run build:local || true) && (npm run build:webpack || true) && (npm run serve || true)

You could then alias this as a separate script in your package.json:

bar: (npm run build:local || true) && (npm run build:webpack || true) && (npm run serve || true)

("bar" = "build and run")

And run as:

npm run bar