简体   繁体   English

如何为每个项目配置 npm 让我的队友拥有相同的配置?

[英]How to configure npm per project for my teammates to have the same config?

Recently, I ran accross a npm install issue, where I had to do either: npm install --legacy-peer-deps either npm config set legacy-peer-deps true .最近,我遇到了一个npm install问题,我必须执行以下任一操作: npm install --legacy-peer-deps或者npm config set legacy-peer-deps true

I'm not really sure why, but anyway, since it's a team project, that we have some devops scripts, I would like to know if there is a way to basically have a file with information on how npm should be configured for the team.我不太确定为什么,但无论如何,因为这是一个团队项目,我们有一些 devops 脚本,我想知道是否有一种方法可以基本上拥有一个文件,其中包含有关如何为团队配置 npm 的信息.

Something in the package.json or an.something to make sure everybody using this repository have a the npm config set legacy-peer-deps true ? package.json 或 an.something 中的某物以确保使用此存储库的每个人都有npm config set legacy-peer-deps true

Thank you谢谢

Try adding a per-project configuration file , aka a .npmrc file that sits alongside package.json and is committed into source control.尝试添加一个每个项目的配置文件,也就是一个.npmrc文件,它位于package.json旁边并提交到源代码管理中。

# .npmrc
legacy-peer-deps=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM