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?
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.
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.
This one-liner should work:
npm start --prefix path/to/your/app
Corresponding doc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With