Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 335
Aalex Gabi Avatar asked May 27 '16 14:05

Aalex Gabi


1 Answers

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
like image 162
Aalex Gabi Avatar answered Sep 28 '22 17:09

Aalex Gabi