我对nodejs是新手。我有包裹。像这样的json
{
...
"peerDependencies": {
"react": "16.0.0"
},
"dependencies": {
"some-lib-that-use-old-react": "git+ssh://git@bitbucket.org/xx/somelib.git",
"other-lib-that-use-old-react": "git+ssh://git@bitbucket.org/xx/other.git"
},
...
}
在我跑步之后
npm install
我得到这样的项目树
node_modules
|
|__some-lib-that-use-old-react
|__other-lib-that-use-old-react
|__react
我使用peerDependencies,因为不需要
react
在里面
some lib
和
other lib
(这是我所期望的)
但react的版本不是
16.0.0
. 它是来自其他库的旧版本。
我可以获得react 16.0.0吗
peerDependencies
?
我想要一个我将使用的lib位置
对等依赖项
而不是
dependencies
.
我已经试过了
npm-shrinkwrap.json
这样地
{
"dependencies": {
"react": { "version": "16.0.0", "from": "react@16.0.0" }
}
}
但这不适合
This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0.
我使用
npm 5.5.1 & node 8.9.3
. 而且没有
package-lock.json
安装前。
谢谢大家来帮忙。
更新1
我将操作系统从mac改为windows,但它也不起作用。
npm cache clean --force
也帮不上忙。
更新2
包装内。react after的json
npm i
看起来像这样
{
"_from": "react@old-version",
"_id": "react@old-version",
...
"_requiredBy": [
"/some-lib-that-use-old-react",
"/other-lib-that-use-old-react"
],
...
"version": "old-version"
}