{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/6549","labels_url":"https://api.github.com/repos/npm/npm/issues/6549/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/6549/comments","events_url":"https://api.github.com/repos/npm/npm/issues/6549/events","html_url":"https://github.com/npm/npm/issues/6549","id":46589843,"number":6549,"title":"Update package to the latest version compatible with the range listed in package.json","user":{"login":"UltCombo","id":2090712,"avatar_url":"https://avatars.githubusercontent.com/u/2090712?v=3","gravatar_id":"","url":"https://api.github.com/users/UltCombo","html_url":"https://github.com/UltCombo","followers_url":"https://api.github.com/users/UltCombo/followers","following_url":"https://api.github.com/users/UltCombo/following{/other_user}","gists_url":"https://api.github.com/users/UltCombo/gists{/gist_id}","starred_url":"https://api.github.com/users/UltCombo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UltCombo/subscriptions","organizations_url":"https://api.github.com/users/UltCombo/orgs","repos_url":"https://api.github.com/users/UltCombo/repos","events_url":"https://api.github.com/users/UltCombo/events{/privacy}","received_events_url":"https://api.github.com/users/UltCombo/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/npm/npm/labels/documentation","name":"documentation","color":"d105f0"},{"url":"https://api.github.com/repos/npm/npm/labels/feature-request","name":"feature-request","color":"ACE1AF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2014-10-23T05:25:18Z","updated_at":"2015-02-22T04:46:40Z","closed_at":null,"body":"As the title suggests, I want to update an installed package to the latest version available which satisfies the version range listed in the `package.json`.\r\n\r\nFor instance, using Grunt.js as an example:\r\n\r\nAssume I have Grunt 3.x installed, the `package.json` containing:\r\n\r\n```\r\n  \"devDependencies\": {\r\n    \"grunt\": \"^0.3.15\"\r\n  },\r\n```\r\n\r\nFor a practical test case, the above `package.json` can be reproduced with:\r\n\r\n```\r\nnpm i --save-dev grunt@0.3.15\r\n```\r\n\r\nNow, I want to install the given package's latest version which is still compatible with the range listed in `package.json` (in this case, the latest Grunt 0.3.x).\r\n\r\nFrom testing and fiddling around, I've found that this does exactly what I want:\r\n\r\n```\r\nnpm i grunt\r\n```\r\n\r\nThe command above, when executed in a directory containing a `package.json` with a `\"grunt\": \"^0.3.15\"` dependency, will install Grunt 0.3.17 (the current latest version compatible with the ^0.3.15 range). To be clear, the behavior I seek is:\r\n\r\n- Should update a package to the latest version which satisfies the version range determined in the `package.json`'s `dependencies`/`devDependencies`;\r\n- Should check if there are new versions of the package and its dependencies even if the given package is already installed in the `node_modules` directory;\r\n- Should be **recursive**: it should walk the given package's whole dependency tree, updating dependencies to the latest version which satisfies the given version range listed in its parent's `package.json`.\r\n\r\nLooks like `npm install packageName` satisfies all my conditions above. However, I could not find this behavior documented anywhere. Is all this behavior actually expected? What I mean is, is this future-proof? Can I rely on this behavior for updating my dependencies to their latest compatible version? If so, it may be worth adding a note to the [npm-install docs](https://www.npmjs.org/doc/cli/npm-install.html).\r\n\r\nThanks for your time."},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/75419566","html_url":"https://github.com/npm/npm/issues/6549#issuecomment-75419566","issue_url":"https://api.github.com/repos/npm/npm/issues/6549","id":75419566,"user":{"login":"othiym23","id":418097,"avatar_url":"https://avatars.githubusercontent.com/u/418097?v=3","gravatar_id":"","url":"https://api.github.com/users/othiym23","html_url":"https://github.com/othiym23","followers_url":"https://api.github.com/users/othiym23/followers","following_url":"https://api.github.com/users/othiym23/following{/other_user}","gists_url":"https://api.github.com/users/othiym23/gists{/gist_id}","starred_url":"https://api.github.com/users/othiym23/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/othiym23/subscriptions","organizations_url":"https://api.github.com/users/othiym23/orgs","repos_url":"https://api.github.com/users/othiym23/repos","events_url":"https://api.github.com/users/othiym23/events{/privacy}","received_events_url":"https://api.github.com/users/othiym23/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T04:46:40Z","updated_at":"2015-02-22T04:46:40Z","body":"@UltCombo in your case, I think you probably want to wait for `npm@3`, then, which should handle this case better (right, @iarna?)."}}