Search code examples
javascriptnode.jsreactjsnpm

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?


Solution

  • 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",
        ...
      }