为什么npm-remote-ls缺少模块的package.json中列出的依赖项?

pu3pd22g  于 12个月前  发布在  其他
关注(0)|答案(1)|浏览(136)

假设我有以下nodejs脚本:

let ls = require('npm-remote-ls').ls
let config = require('npm-remote-ls').config
config({development:false,optional:true})
ls('node-gyp','9.3.1',console.log)

字符串
它记录:

{
  '[email protected]': {
    '[email protected]': {},
    '[email protected]': {},
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {},
      '[email protected]': [Object]
    },
    '[email protected]': { '[email protected]': {} },
    '[email protected]': {
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object]
    },
    '[email protected]': { '[email protected]': [Object] },
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {}
    },
    '[email protected]': { '[email protected]': {} },
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {},
      '[email protected]': {}
    },
    '[email protected]': { '[email protected]': {} }
  }
}


node-gyp的package.json在dependencies字段中包含"exponential-backoff": "^3.1.1",,所以我希望在上面的输出中看到它;但我没有。
为什么我没有在npm-remote-ls的输出中列出exponential-backoff?我如何调整脚本以获得完整的依赖项列表?或者有其他更简单的方法来获得完整的依赖项列表?

goucqfw6

goucqfw61#

版本9.3.1没有exponential-backoff作为依赖项,这就是为什么它不显示。请参阅version 9.3.1 herepackage.json
如果您更改为10.0.1latest版本,则依赖项。

ls('node-gyp','latest',console.log)

字符串
然后"exponential-backoff": "^3.1.1"在那里:

{
  '[email protected]': {
    '[email protected]': { '[email protected]': [Object] },
    '[email protected]': { '[email protected]': {} },
    '[email protected]': { '[email protected]': {} },
    '[email protected]': {},
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {}
    },
    '[email protected]': {},
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': {},
      '@npmcli/[email protected]': [Object]
    },
    '[email protected]': {
      '[email protected]': [Object],
      '[email protected]': [Object],
      '[email protected]': {},
      '[email protected]': [Object],
      '[email protected]': [Object]
    },
    '[email protected]': {},
    '[email protected]': {}
  }
}


它看起来像是为9.4.0 here版本引入的,所以你可能正在查看版本之间的git提交。

相关问题