简体   繁体   中英

npm install --save-exact not respecting exact version

My environment:

  • node v6.17.1
  • npm v6.14.4

I ran npm install --save --save-exact mjml@4.5.1 , and afterward my package.json shows

"mjml": "4.5.1",

My package-lock.json shows:

 "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"
      }
    }

Also none of my other dependencies have mjml as a subdependency.

However, when I run npm show mjml version I get: 4.6.2 .

I thought using --save-exact would install the exact version 4.5.1, so what am I not understanding?

You're assumption that --save-exact will install the exact version ( 4.5.1 ) is correct.

However, when you utilize the npm show command, ie when you run:

npm show mjml version

you're essentially performing a http GET request to the npm registry at https://registry.npmjs.org/mjml . The aforementioned command queries the registry/database and returns the latest version of mjml which is available in the registry, ie version 4.6.2 in this case.

To obtain/check which version of mjml has been installed you need to utilize the npm ls command instead.

  1. cd to your project directory.
  2. Then run:

     npm ls mjml

    This will print the following to your console:

     └── mjml@4.5.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM