Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm update doesn't update certain packages

With recent update of React to 0.15 where they fixed excessive generation of tags, I decided to update the project.

The problem is that when I did npm update, it updated to 0.14.8 and that's it. npm outdated shows:

Package       Current  Wanted        Latest  Location
history        1.17.0  1.17.0         2.1.0  history
react          0.14.8  0.14.8        15.0.1  react
react-dom      0.14.8  0.14.8        15.0.1  react-dom
react-router    1.0.3   1.0.3         2.3.0  react-router
react-select    0.9.1   0.9.1  1.0.0-beta12  react-select

My package.json looks like:

"dependencies": {
    "extract-text-webpack-plugin": "^1.0.1",
    "history": "^1.17.0",
    "moment": "^2.11.0",
    "node-sass": "^3.4.2",
    "react": "^0.14.5",
    "react-dom": "^0.14.5",
    "react-recaptcha": "^2.0.1",
    "react-redux": "^4.0.6",
    "react-router": "^1.0.3",
    "react-select": "^0.9.1",
    "redux": "^3.0.5",
    "sass-loader": "^3.1.2"
  }

I tried to change versions to 0.15.0, but then I get an error:

npm ERR! notarget No compatible version found: react-dom@'>=0.15.0 <0.16.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.14.0-beta1","0.14.0-beta2","0.14.0-beta3","0.14.0-rc1","0.14.0","0.14.1","0.14.2","0.14.3","0.14.4","0.14.5","0.14.6","0.15.0-alpha.1","0.14.7","15.0.0-rc.1","15.0.0-rc.2","0.14.8","15.0.0","15.0.1"]

I am still new with npm, so sorry if the question is stupid. What is the right way to update all that packages?

like image 247
Battle_Slug Avatar asked Apr 20 '16 03:04

Battle_Slug


People also ask

Does npm update packages automatically?

Run npm update to automatically update my packages to the latest versions From docs: > This command will update all the packages listed to the latest version (specified by the tag config), respecting the semver constraints of both your package and its dependencies (if they also require the same package).

Does npm update change package json?

As of [email protected] , the npm update will change package. json to save the new version as the minimum required dependency. To get the old behavior, use npm update --no-save .


1 Answers

In this case npm update works as expected. Latest version that satisfies caret dependency "^0.14.5" is 0.14.8. React switched to using major versions after v0.14.8 (see React blog). Latest stable version now is 15.x not 0.15.x, so you should update your package.json file:

"dependencies": {
    ...
    "react": "^15.0.1",
    "react-dom": "^15.0.1",
    ...
  }
like image 198
Stubb0rn Avatar answered Oct 24 '22 22:10

Stubb0rn