Skip to content

Instantly share code, notes, and snippets.

@kitsune7
Last active February 27, 2024 17:43
Show Gist options
  • Save kitsune7/2831fc5a61cd8677e87249b4003b785b to your computer and use it in GitHub Desktop.
Save kitsune7/2831fc5a61cd8677e87249b4003b785b to your computer and use it in GitHub Desktop.
npm version reference
{
  "dependencies": {
    // Use a Github repository
    "@formio/vue": "github:kitsune7/vue",
    
    // Use a PR on Github
    "@formio/vue": "github:formio/vue#pull/77/head",
    
    // MINOR and PATCH updates allowed (default when using `npm install` to add to package.json)
    // version >= 5.0.0 && version < 6.0.0
    "@formio/vue": "^5.0.0",
    
    // PATCH updates allowed
    // version >= 5.0.0 && version < 5.1.0
    "@formio/vue": "~5.0.0",
    
    // No updates allowed; the version is locked
    // version == 5.0.0
    "@formio/vue": "5.0.0",
    
    // Gets whatever the latest version is
    "@formio/vue": "latest",
    
    // Use any version (defaults to latest)
    // This is usually used in npm workspaces to use local packages
    "@formio/vue": "*"
  }
}

To install a specific version of something:

npm install --save PACKAGE_NAME@VERSION_STRING

# For example, any of these would work
npm install --save @formio/vue@github:kitsune7/vue
npm install --save @formio/vue@github:kitsune7/vue#pull/77/head
npm install --save @formio/vue@latest
npm install --save @formio/vue@~5.0.0
npm install --save @formio/vue@*

Note: If you run a command like npm install --save @formio/vue@5.0.0 that locks it to a specific version, it will still add a caret at the beginning, so you'll have to remove that in package.json and run npm install to update the package lock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment