I got 3 dependencies on my project, when I run npm update
it doesn't update the version of one dependency (axios).
Here is my package.json
file:
{
...
"dependencies": {
"axios": "^0.25.0",
"date-fns": "^2.26.0",
"lodash": "^4.17.15"
}
}
When I enter the npm update
or npm update --save
command, this is the my actual result:
{
...
"dependencies": {
"axios": "^0.25.0",
"date-fns": "^2.29.1",
"lodash": "^4.17.21"
}
}
As I can see, the axios
package doesn't get updated.
My expected result is to get the axios package at version 0.27.2 (latest at this day).
CodePudding user response:
From docs
Caret Ranges ^1.2.3 ^0.2.5 ^0.0.4
Allows changes that do not modify the left-most non-zero element in the
[major, minor, patch]
tuple.
Since your axios
dependency is defined as ^0.25.0
, with its minor version 25
being the left-most non-zero element, it will allow update to 0.25.X
, but not to 0.27.0
.
Either change the dependency in your package.json, or let npm
do it. This should install the newest version:
npm install axios@* --save
CodePudding user response:
You can use npm update -d
or npm update --save-dev
to update developer dependencies. (Dependencies used in development) Using npm update
only would ignore the dev dependencies.
CodePudding user response:
You can now use the command npm install axios
and it will automatically update axios
in your package.json