【问题标题】:Warnings about peer dependencies when running npm install运行 npm install 时有关对等依赖项的警告
【发布时间】:2018-09-18 05:32:45
【问题描述】:

我正在尝试更新我的 React/Firebase 项目

npm install --save firebase-functions@latest

我收到很多警告:

npm WARN google-maps-react@2.0.0 requires a peer of react@~0.14.8 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN google-maps-react@2.0.0 requires a peer of react-dom@~0.14.8 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions@1.0.1 requires a peer of firebase-admin@~5.12.0 but none is installed. You must install peer dependencies yourself.

我是新手,所以不确定应该运行哪个命令来修复警告。

【问题讨论】:

    标签: reactjs firebase npm warnings


    【解决方案1】:

    手动安装:

    使用 npm 5.0.0 或更高版本(已编辑):

    npm install react@^16.0.0
    npm install react-dom@^16.0.0
    npm install firebase-admin@~5.12.0
    npm install firebase-functions@latest
    

    在 npm 5.0.0 之前(原版):

    npm install --save react@^16.0.0
    npm install --save react-dom@^16.0.0
    npm install --save firebase-admin@~5.12.0
    npm install --save firebase-functions@latest
    

    【讨论】:

    • 您能解释一下为什么会这样吗?为什么不直接安装它的依赖项?
    • 因为 firebase-admin 被声明为对 firebase-functions 的对等依赖。请参阅第 54 行的package.json。它们不会自动安装。
    • 从 npm 5.0.0 开始,已安装的模块默认添加为依赖项,因此不再需要 --save 选项。
    猜你喜欢
    • 2015-02-25
    • 2019-08-13
    • 1970-01-01
    • 1970-01-01
    • 2016-04-02
    • 2021-04-30
    • 1970-01-01
    • 2020-05-12
    • 2018-08-31
    相关资源
    最近更新 更多