Nodejs中同一个包在dependencies和peerDependencies中的版本不一致

发布于 1周前 作者 gougou168 来自 nodejs/Nestjs

Nodejs中同一个包在dependencies和peerDependencies中的版本不一致

  “node_modules/react-sortable-tree”: {
“version”: “2.8.0”,
“resolved”: “https://registry.npmjs.org/react-sortable-tree/-/react-sortable-tree-2.8.0.tgz”,
“integrity”: “sha512-gTjwxRNt7z0FC76KeNTnGqx1qUSlV3N78mMPRushBpSUXzZYhiFNsWHUIruyPnaAbw4SA7LgpItV7VieAuwDpw==”,
“dev”: true,
“dependencies”: {
“frontend-collective-react-dnd-scrollzone”: “^1.0.2”,
“lodash.isequal”: “^4.5.0”,
“prop-types”: “^15.6.1”,
“react-dnd”: “^11.1.3”,
“react-dnd-html5-backend”: “^11.1.3”,
“react-lifecycles-compat”: “^3.0.4”,
“react-virtualized”: “^9.21.2”
},
“peerDependencies”: {
“react”: “^16.3.0”,
“react-dnd”: “^7.3.0”,
“react-dom”: “^16.3.0”
}
}

dependencies 里面是
"react-dnd": "^11.1.3",

peerDependencies 里面是
"react-dnd": "^7.3.0",

什么原因会导致这种情况呢?

npm install 时,会报错,说^7.3.0 找不到,因为已经有了^11.*.*的版本。这让我只能用 --legacy-peer-deps 来避免这个 react-dnd 包的版本问题。


回到顶部