-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
npm update package --save removes some version range symbols (I have only tested ~ and ^) from package.json
Expected Behavior
It doesn't remove them.
Steps To Reproduce
- Fresh project created with
npm init - With
package.jsoncontents:
{
"name": "npmbug",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"emoji-poop": "~1.2.0"
}
}- Run
npm update emoji-poop --save - The version becomes
1.2.1instead of~1.2.1
Environment
- npm: 10.9.0
- Node.js: 20.11.1
- OS Name: Mac OS
- System Model Name: Macbook Pro M1
- npm config:
; "user" config from /Users/r.troha/.npmrc
<redacted>
package-lock = true
save-exact = true
save-prefix = ""
; "env" config from environment
python = "/opt/homebrew/python/bin/python3.8"
; node bin location = /Users/r.troha/.volta/tools/image/node/20.11.1/bin/node
; node version = v20.11.1
; npm local prefix = /Users/r.troha/Projects/npmbug
; npm version = 10.9.0
; cwd = /Users/r.troha/Projects/npmbug
; HOME = /Users/r.troha
; Run `npm config ls -l` to show all defaults.Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps