[英]How to override npm project config?
I have a nodejs project and placed .npmrc file at root to override default npm config.我有一个 nodejs 项目,并在根目录下放置了 .npmrc 文件来覆盖默认的 npm 配置。 I need to change the npm project config while building the project.
我需要在构建项目时更改 npm 项目配置。 Is there any option available to override the npm project config?
是否有任何选项可用于覆盖 npm 项目配置?
I tried to run this我试图运行这个
npm config set registry "https://registry.npmjs.org/"
but it couldn't override the npm project config.但它无法覆盖 npm 项目配置。
To override use --registry
覆盖使用
--registry
sample format npm --registry registryurl install packagename
示例格式
npm --registry registryurl install packagename
I realize this is very old.我意识到这是非常古老的。 However, I believe that the project specific
.npmrc
file overwrites your global .npmrc
file, not the global overwriting the project as you seemed to mention in your question.但是,我相信特定于项目的
.npmrc
文件会覆盖您的全局.npmrc
文件,而不是您在问题中似乎提到的全局覆盖项目。
From my research, it appears that there is no project-specific argument for the npm config set
command.根据我的研究,似乎
npm config set
命令没有特定于项目的参数。 It only works on the global file, I think...它只适用于全局文件,我认为......
I found success by just running all the npm config set <key> <value>
commands I needed, going to my global .npmrc
file and copying all the new key/value pairs, pasting those into my project specific .npmrc
file, then going back and deleting those new key/values from my global .npmrc
file.我通过运行我需要的所有
npm config set <key> <value>
命令找到了成功,转到我的全局.npmrc
文件并复制所有新的键/值对,将它们粘贴到我的项目特定的.npmrc
文件中,然后去返回并从我的全局.npmrc
文件中删除那些新的键/值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.