【问题标题】:npm install --save-exact not respecting exact versionnpm install --save-exact 不尊重确切版本
【发布时间】:2020-08-08 14:45:27
【问题描述】:

我的环境:

  • 节点 v6.17.1
  • npm v6.14.4

我跑了npm install --save --save-exact mjml@4.5.1,然后我的package.json 显示

"mjml": "4.5.1",

我的package-lock.json 显示:

 "mjml": {
      "version": "4.5.1",
      "resolved": "https://npm.alertmd.io/mjml/-/mjml-4.5.1.tgz",
      "integrity": "sha512-sQVbQ30UwxMpjzkTPdU9RD5OC9ikEjtZEY+zqAioHXAtEmiO0L0eUdfpcb0ni1pu09hMWU4iqRtOyxLgZIOThg==",
      "requires": {
        "mjml-accordion": "4.5.1",
        "mjml-body": "4.5.1",
        "mjml-button": "4.5.1",
        "mjml-carousel": "4.5.1",
        "mjml-cli": "4.5.1",
        "mjml-column": "4.5.1",
        "mjml-core": "4.5.1",
        "mjml-divider": "4.5.1",
        "mjml-group": "4.5.1",
        "mjml-head": "4.5.1",
        "mjml-head-attributes": "4.5.1",
        "mjml-head-breakpoint": "4.5.1",
        "mjml-head-font": "4.5.1",
        "mjml-head-preview": "4.5.1",
        "mjml-head-style": "4.5.1",
        "mjml-head-title": "4.5.1",
        "mjml-hero": "4.5.1",
        "mjml-image": "4.5.1",
        "mjml-migrate": "4.5.0",
        "mjml-navbar": "4.5.1",
        "mjml-raw": "4.5.1",
        "mjml-section": "4.5.1",
        "mjml-social": "4.5.1",
        "mjml-spacer": "4.5.1",
        "mjml-table": "4.5.1",
        "mjml-text": "4.5.1",
        "mjml-validator": "4.5.0",
        "mjml-wrapper": "4.5.1"
      }
    }

我的其他依赖项都没有 mjml 作为子依赖项。

但是,当我运行 npm show mjml version 时,我得到:4.6.2

我认为使用 --save-exact 会安装确切的 4.5.1 版本,所以我不明白什么?

【问题讨论】:

    标签: node.js npm mjml


    【解决方案1】:

    您假设--save-exact 将安装正确的版本 (4.5.1)。

    但是,当您使用 npm show 命令时,即当您运行时:

    npm show mjml version
    

    您实际上是在向位于 https://registry.npmjs.org/mjml 的 npm 注册表执行 http GET 请求。上述命令查询注册表/数据库并返回注册表中可用的最新版本mjml,在本例中为版本4.6.2

    要获取/检查安装了哪个版本的mjml,您需要使用 npm ls 命令。

    1. cd 到您的项目目录。
    2. 然后运行:

      npm ls mjml
      

      这会将以下内容打印到您的控制台:

      └── mjml@4.5.1
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-18
      • 1970-01-01
      • 2016-08-18
      • 2018-06-13
      • 1970-01-01
      • 2016-01-08
      • 2021-11-11
      • 1970-01-01
      相关资源
      最近更新 更多