简体   繁体   English

NPM 是否具有用于对等依赖项安装的标志?

[英]Does NPM have a flag for peer dependency install?

Looking through the documentation I see -S , -O , -D etc. options for installing dependencies, but I don't see a flag for installing to the peer dependency block.查看文档,我看到-S-O-D等用于安装依赖项的选项,但我没有看到安装到对等依赖项块的标志。

Does NPM have a flag for installing to peer dependencies? NPM 是否有用于安装对等依赖项的标志?

Per https://blog.npmjs.org/post/110924823920/npm-weekly-5 ,根据https://blog.npmjs.org/post/110924823920/npm-weekly-5

Peer dependencies won't be automatically installed and you must install them manually.对等依赖项不会自动安装,您必须手动安装它们。

If you want to save peer dependencies for your project, install with the --peer flag.如果要保存项目的对等依赖项,请使用 --peer 标志进行安装。

No, there is no CLI flag to install as a peer dependency.不,没有要作为对等依赖项安装的 CLI 标志。

You will need to manually edit package.json to add a property peerDependencies .您需要手动编辑package.json以添加属性peerDependencies

{
  "name": "my-package",
  "version": "1.0.0",
  "peerDependencies": {
    "cuid": "^2.1.0"
  }
}

https://docs.npmjs.com/files/package.json#peerdependencies https://docs.npmjs.com/files/package.json#peerdependencies

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

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