为什么安装npm说我有未满足的依赖? [英] Why does npm install say I have unmet dependencies?
问题描述
npm install
时,它会安装一堆东西,然后打印出如下所示的几个错误信息:
npm WARN unmet依赖/ Users / seanmackesey / google_drive / code / explore / generator / node_modules / findup-sync / node_modules / glob要求graceful-fs@'~1.2.0'但是会加载
我必须对什么是 npm安装
确实感到困惑。如果检测到依赖关系,应该不会安装它?在什么条件下给我这样的错误信息,如何解决依赖关系?
我相信是因为依赖解决方案有点破碎,
请参阅 https://github.com/isaacs/npm / issues / 1341#issuecomment-20634338
您可能需要手动安装未满足依赖关系的顶级模块:
npm install findup-sync@0.1.2
或构造您的package.json,使得任何其他模块的依赖关系的顶级模块都列在下面。
您的问题也可能是npm无法下载包,超时或什么。有时重新运行 npm install
来补救。您还可以使用 npm install findup-sync@0.1.2
手动安装失败的软件包
。
再次尝试 npm安装
之前可能有帮助的其他步骤是:
- 删除
node_modules
使用rm -rf node_modules /
- 运行
npm缓存清理
删除 node_modules
有时是必要的:显然,如果嵌套模块在 npm install
期间无法安装,则后续的 npm install
将不会检测到那些缺少的嵌套依赖关系。如果是这种情况,有时删除那些缺少嵌套模块的顶级依赖关系,再次运行 npm install
就足够了。请参阅 https://github.com/npm/npm/issues/1336
I have a node package. When I run npm install
from the package root, it installs a bunch of things, but then prints several error messages that look like this:
npm WARN unmet dependency /Users/seanmackesey/google_drive/code/explore/generator/node_modules/findup-sync/node_modules/glob requires graceful-fs@'~1.2.0' but will load
I must be confused about what exactly npm install
does. If it detects a dependency, shouldn't it install it? Under what conditions does it give me error messages like this, and how can I resolve the dependencies?
I believe it is because the dependency resolution is a bit broken, see https://github.com/isaacs/npm/issues/1341#issuecomment-20634338
You may need to manually install top-level modules that have unmet dependencies:
npm install findup-sync@0.1.2
Or structure your package.json such that any top-level modules that are also dependencies of other modules are listed lower down.
Your problem could also be that npm failed to download the package, timed-out or whatnot. Sometimes re-running npm install
remedies it. You can also install the failed packages
manually as well using npm install findup-sync@0.1.2
.
Other steps that may help before attempting npm install
again are:
- remove
node_modules
usingrm -rf node_modules/
- run
npm cache clean
To explain why removing node_modules
sometimes is necessary: Apparently if a nested module fails to install during npm install
, subsequent npm install
won't detect those missing nested dependencies. If that's the case, sometimes it's sufficient to remove the top-level dependency of those missing nested modules, and running npm install
again. See https://github.com/npm/npm/issues/1336
这篇关于为什么安装npm说我有未满足的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!