尝试 npm install
时出现这些错误。
如果我使用的是最新版本的 React,则无法理解为什么它没有运行。npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!npm ERR! peerinvalid Peer [email protected] wants react@^15.2.1npm ERR! peerinvalid Peer [email protected] wants react@^0.14.5npm ERR! peerinvalid Peer [email protected] wants react@^15.2.1npm ERR! peerinvalid Peer [email protected] wants react@^0.14.7 || ^15.0.0-0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0npm ERR! peerinvalid Peer [email protected] wants react@~15.2.0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-rc.1
最佳答案
那是因为您项目中的其他包需要较低版本的 React,例如 15.0,而不是 15.2。您可以在此处 https://nodejs.org/en/blog/npm/peer-dependencies/#the-solution-peer-dependencies 和此处 https://docs.npmjs.com/files/package.json#peerdependencies 阅读有关 peerDependencies 的更多信息
解决您的问题,在更新其他库之前不要升级您的 React 版本。
关于javascript - 包 [email protected] 不满足其 sibling 的 peerDependencies 要求,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38351096/