radbyx radbyx - 9 months ago 41
Node.js Question

Commandline - Change path and run "npm install" on the same line

Is it possible to write a Command line that changes path before

npm install

e.g. command line:

- cd /d "d:\development\test" npm install

We want to execute
npm install
from our build server, hence we first need to change the path so Node will install
in the right directory.

Answer Source
cd /d "d:\development\test" && npm install

The && operator will execute the right cmd part only if the left one succeed. If you want to execute nom install even if the left part failed, use

cd /d "d:\development\test"; npm install