node.js 如何指定`package.json` 到npm 的路径?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37078968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 20:10:51 来源:igfitidea点击:
How to specify the path of `package.json` to npm?
提问by rinogo
I use npmscripts 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:
我使用npm脚本来构建我的项目。我希望能够从不同的目录运行脚本。也就是说,而不是执行以下操作:
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?
这可能吗?

