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条)

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题