Welcome to the Linux Foundation Forum!

semver package question

Posts: 22
edited November 2021 in LFW211 Class Forum

I have been trying to understand how works npm i, how works caret and tilde but I don't know why I can not save with the command npm i a tilde or other any expression of semver.

The semver prefix is defined by the save-prefix config. The default value is a caret (^) which you can check by running the following npm config command:

npm config get save-prefix

npm i pino@6.x.x save in package.json ^6.13.3
npm i pino@"~6.11" save in package.json ^6.11.3
npm i pino@"6.11.x" save in package.json ^6.11.3

the only way to see what i want is update manually my package.json

  1. "dependencies": {
  2. "pino1": "^6.11.1"
  3. "pino2": "~6.11"
  4. "pino3": "6.x.x"
  5. "pino3": "6.11.x"
  6. }

Comments

  • Posts: 22
    edited November 2021

    i tested all here: https://semver.npmjs.com/

    1. ~version Approximately equivalent to version”, will update you to all future patch versions, without incrementing the minor version. ~1.2.3 will use releases from 1.2.3 to <1.3.0.
    2. ^version Compatible with version”, will update you to all future minor/patch versions, without incrementing the major version. ^2.3.4 will use releases from 2.3.4 to <3.0.0.
  • hi @jhonny111s

    • npm install doesn't support the syntax you're trying to use
    • the semver save prefix is a configuration option, not a command-line flag
    • editing the package.json is the way to specify more nuanced versioning strategies

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Welcome!

It looks like you're new here. Sign in or register to get started.
Sign In

Categories

Upcoming Training