After npm install
on clean environment, I get following problem with b
package:
在干净环境下安装npm之后,我遇到了以下b包的问题:
npm ls b
a@2.0.6
├── b@3.0.0
├─┬ c@3.0.1
│ └── UNMET DEPENDENCY b@^1.0.0
└─┬ d@4.1.1
└─┬ c@2.1.0
└── UNMET DEPENDENCY b@^1.0.0
npm ERR! missing: b@^1.0.0, required by c@3.0.1
npm ERR! missing: b@^1.0.0, required by c@2.1.0
This obviously causes errors, as package c
needs b@^1.0.0
, but receives b@3.0.0
.
这显然会导致错误,因为包c需要b@^1.0.0,但收到b@3.0.0。
I struggled to force npm to install both versions as if they were different packages. Tried going through npm docs, package-locks, and shinkwrap, but with no success. How can I solve this problem?
我努力强迫npm安装两个版本,好像它们是不同的包。尝试通过npm docs,package-locks和shinkwrap,但没有成功。我怎么解决这个问题?
Environment info:
环境信息:
OS: macOS High Sierra 10.13.4
npm: 6.10
node: v8.8.1
1 个解决方案
#1
0
Playing around I noticed, that a lot of packages had UNMET DEPENDENCY. Following procedure fixed the problem:
四处玩,我注意到,很多包都有UNMET DEPENDENCY。以下程序修复了问题:
rm -rf node_modules
npm cache clean --force
npm install
After cleaning npm cache the issue is completely resolved:
清理npm缓存后,问题完全解决:
a@2.0.6
├── b@3.0.0
├─┬ c@3.0.1
│ └── b@^1.0.0
└─┬ d@4.1.1
└─┬ c@2.1.0
└── b@^1.0.0
Strange bug.
奇怪的错误。
#1
0
Playing around I noticed, that a lot of packages had UNMET DEPENDENCY. Following procedure fixed the problem:
四处玩,我注意到,很多包都有UNMET DEPENDENCY。以下程序修复了问题:
rm -rf node_modules
npm cache clean --force
npm install
After cleaning npm cache the issue is completely resolved:
清理npm缓存后,问题完全解决:
a@2.0.6
├── b@3.0.0
├─┬ c@3.0.1
│ └── b@^1.0.0
└─┬ d@4.1.1
└─┬ c@2.1.0
└── b@^1.0.0
Strange bug.
奇怪的错误。