Memor.の 2013-12-24 17:49 采纳率: 100%
浏览 979
已采纳

为什么 npm 安装说我有未被满足的依赖?

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?

转载于:https://stackoverflow.com/questions/20764881/why-does-npm-install-say-i-have-unmet-dependencies

  • 写回答

15条回答

  • 叼花硬汉 2013-12-24 18:37
    关注

    I believe it is because the dependency resolution is a bit broken, see https://github.com/isaacs/npm/issues/1341#issuecomment-20634338

    Following are the possible solution :

    1. Manually need to install the top-level modules, containing unmet dependencies: npm install findup-sync@0.1.2

    2. Re-structure your package.json. Place all the high-level modules (serves as a dependency for others modules) at the bottom.

    3. Re-run the 'npm install' command.

    The problem could be caused by npm's failure to download all the package due to timed-out or something else.

    Note: You can also install the failed packages manually as well using npm install findup-sync@0.1.2.

    Before running 'npm install', performing the following steps may help:

    • remove node_modules using rm -rf node_modules/
    • run npm cache clean

    Why 'removing node_modules' sometimes is necessary? When 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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(14条)

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料