I use npm
scripts to build my project. I'd like to be able to run the scripts from a different directory. That is, instead of doing the following:
cd project; npm run build; cd ..
...I'd like to simply do something like:
npm run build -config project/package.json;
or
npm run build -wd project;
Is this possible?
The package. json file is normally located at the root directory of a Node. js project. The name field should explain itself: this is the name of your project.
the package is installed in the current file tree, under the node_modules subfolder. As this happens, npm also adds the lodash entry in the dependencies property of the package. json file present in the current folder.
Use the engines keyword in the package. json file to specify the Node. js version that you want your application to use. You can also specify a version range using npm notation.
Using --prefix
worked for me:
npm --prefix /path/to/project run build
Where path/to/project
is the directory where your package.json with build
command defined.
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