Skip to content Skip to sidebar Skip to footer

How To Make A Npm Command, That Executes Two Commands In The Console (one After Another)?

How can I make a command in the package.json file, that executes two commands for the terminal (console) one after another? This question refers to node.js and NPM package. I have

Solution 1:

The syntax I'm aware of involves using && to separate the commands, i.e.

"cd webdir && node ..."

This should work both on Windows and on Unix based systems.

For example, jQuery uses such combined statements in its deploy scripts:

"build":"npm install && grunt","start":"grunt watch","test":"grunt && grunt test:slow","precommit":"grunt lint:newer","commitmsg":"node node_modules/commitplease"

See https://github.com/jquery/jquery/blob/master/package.json

Solution 2:

Try a semi-colon after your first CLI statement, then your second statement after the semi-colon.

Post a Comment for "How To Make A Npm Command, That Executes Two Commands In The Console (one After Another)?"