gpt4 book ai didi

npm - 需要一个对等点,但没有安装

转载 作者:行者123 更新时间:2023-12-04 12:51:50 25 4
gpt4 key购买 nike

我的 package.json看起来像这样

{
"name": "hello-world",
"version": "1.0.0",
"description": "The Hello World",
"author": "",
"license": "MIT",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"dependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/core": "~2.0.1",
"@angular/http": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/router": "~3.0.1",
"@angular/upgrade": "~2.0.1",

"systemjs": "0.19.39",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.25",

"angular-in-memory-web-api": "~0.1.1",
"bootstrap": "4.0.0-alpha.4"
},
"devDependencies": {
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3",
"typings": "^1.4.0"
}
}

当我跑 npm i它运行成功,但我收到了一些警告。
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of zone.js@^0.7.2 but none was installed.

我将这些行添加到 package.json
"peerDependencies": {
"rxjs": "5.0.0-rc.4",
"zone.js": "^0.7.2"
}

但是当我运行 npm i再次我仍然收到此警告
npm WARN hello-world@1.0.0 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN hello-world@1.0.0 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of zone.js@^0.7.2 but none was installed.

主应用程序的附加警告。
为什么会这样以及如何摆脱这个警告?

最佳答案

TL; 博士

对等依赖 是一种特殊的依赖项 - 它们由不直接调用它们的包使用,赋予用户(您)控制权。因此,您必须手动安装这些软件包。

您不需要添加 peerDependencies给您的 package.json .

您看到这些错误的原因是,您的某些依赖项声明 rxjs@5.0.0-rc.4zone.js@^0.7.2在他们的 package.jsonpeerDependencies .这就是为什么当您添加 peerDependencies 时在您的 package.json ,您会收到两次这些警告。

了解更多 对等依赖 我建议阅读这些:

  • Peer Dependencies
  • What are those PeerDependencies in a NodeJS project?
  • great answer
  • 关于npm - 需要一个对等点,但没有安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44842087/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com