Aalex Gabi
Aalex Gabi

Reputation: 1755

How to run npm install without changing working directory

How to install dependencies for project without changing working directory to project root?

Curently you need to execute:

cd /my/project/root && npm install && cd -

I'm looking for an option like -C for Makefile so that I can:

npm install -C /my/project/root

Any ideas on how to accomplish this?

Upvotes: 17

Views: 9292

Answers (1)

Aalex Gabi
Aalex Gabi

Reputation: 1755

A colleague of mine has found a way to do this (note that this is not documented in npm help but online):

npm install --prefix /my/project/root

Or the short version (only documented online)

npm install -C /my/project/root

Upvotes: 23

Related Questions