【问题标题】:How to find out which packages are compatible with which version of Node?如何找出哪些包与哪个版本的 Node 兼容?
【发布时间】:2020-11-15 08:17:43
【问题描述】:

所以我遇到了 PhantomJS 包的问题。这是一个简短的日志详细信息:

npm ERR! node v4.2.4
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! phantomjs@1.9.17 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs@1.9.17 install script 'node install.js'.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.

遇到这个问题让我开始思考如何确定一个包是否与某个版本的节点兼容?我想知道是否有特定的 Node 资源/指南可用于检查包兼容性,或者社区中的其他人使用什么流程来检查这些内容?

【问题讨论】:

    标签: node.js npm phantomjs package-managers


    【解决方案1】:

    包维护者可以在其包的package.json 的engine 字段中指定兼容的Node.js 版本。请参阅此处的文档:

    https://docs.npmjs.com/files/package.json#engines

    但是这个字段不是强制性的,所以有很多包不提供兼容版本的信息。如果package.json 不包含engines 字段,则值得查看包文档,有时它包含兼容性信息。

    【讨论】:

      猜你喜欢
      • 2021-02-25
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-25
      • 1970-01-01
      • 2017-04-29
      相关资源
      最近更新 更多