小编Sha*_*arg的帖子

需要相同peerDependency的多个版本

当我npm i在我当前的反应项目上运行时,我收到有关反应peerDependency的以下警告:

npm WARN react-tap-event-plugin@3.0.3 requires a peer of react@^16.0.0-0 < 16.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-paginate@4.4.4 requires a peer of react@^15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN formsy-react@0.19.5 requires a peer of react@^0.14.0 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
Run Code Online (Sandbox Code Playgroud)

在我的package.json中,我使用的是最新版本的react:

"react": "^16.7.0"
Run Code Online (Sandbox Code Playgroud)

我是node和npm的新手.我想知道安装npm peerDependencies的好习惯是什么:

1.)如果已在package.json中指定了更新版本,则可以忽略较低版本的警告.

2.)根据 https://lexi-lambda.github.io/blog/2016/08/24/understanding-the-npm-dependency-model/https://github.com/npm/npm/issues/ 6565

npm提供依赖隔离,peerDepencies需要手动安装,所以我应该安装所有3个版本的反应,但我担心会破坏import语句.

3.)如果以上两者都不是,我应该在package.json中使用哪个版本. PS我的package.json中有很多依赖项,也可能需要最新版本.

node.js npm reactjs

6
推荐指数
2
解决办法
845
查看次数

标签 统计

node.js ×1

npm ×1

reactjs ×1