Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get npm start at a different directory?

Tags:

node.js

I usually cd into the app directory and then run npm start.

It is my feeling that there ought to be some way to run npm start with a path parameter. But, the npm start documentation contains no such feature.

I tried myself only to find npm start ./myapp does not work. Is there a way to do that?

like image 694
Blaise Avatar asked Mar 23 '16 07:03

Blaise


People also ask

What directory do I run npm install?

You should run it in your project root folder, or the folder above your node_modules folder as sometimes the structure can differentiate between projects. But in general: the root folder of your project, as long as it is one folder above your node_modules.

What is npm Run command?

npm run sets the NODE environment variable to the node executable with which npm is executed. If you try to run a script without having a node_modules directory and it fails, you will be given a warning to run npm install , just in case you've forgotten.


1 Answers

This one-liner should work:

npm start --prefix path/to/your/app 

Corresponding doc

like image 180
Amaury Liet Avatar answered Oct 19 '22 00:10

Amaury Liet