【问题标题】:heroku nodejs dependencies synthaxheroku node js依赖语法
【发布时间】:2021-12-03 16:22:05
【问题描述】:

指定模块依赖于任何(或最后一个)版本的语法是什么?

我知道对于一个特定的,合成器是:
 "dependencies": {
    "express": "^4.9.8"
  },

最好的问候

【问题讨论】:

  • “在任何(或最后一个)版本上”是什么意思?

标签: node.js heroku dependencies


【解决方案1】:

安装时可以使用 npm install express 获取最新版本。

如果您想要特定版本。 你可以用npm install express@4.9.8安装

【讨论】:

  • 是的,但我希望 Heroku 管道安装最新版本,而不指定精确的。所以我需要 Heroku 的语法。
  • 没有“Heroku 的语法”。不过,package.json 文件 有语法。
  • 不建议每次都更新最新版本。您在开发时使用的包版本;你应该使用它。如果您需要更新每个包,您应该再次测试您的整个项目。它可能会在某个地方发生故障,您必须修复它
【解决方案2】:

好的,
Chris 的回答似乎不错:来自“https://docs.npmjs.com/about-semantic-versioning”:

"You can specify which update types your package can accept from dependencies in your package's package.json file.
For example, to specify acceptable version ranges up to 1.0.4, use the following syntax:
Patch releases: 1.0 or 1.0.x or ~1.0.4
Minor releases: 1 or 1.x or ^1.0.4
Major releases: * or x"

【讨论】:

    猜你喜欢
    • 2019-11-06
    • 1970-01-01
    • 2016-02-19
    • 2015-10-22
    • 2016-09-15
    • 2021-05-05
    • 1970-01-01
    • 1970-01-01
    • 2012-01-04
    相关资源
    最近更新 更多