Is this the correct way updating all modules listed in my package.json file to their current version?

npm update --save

I ask because I am seeing a lot of http 304 messages in the output, suggesting resource already exists (rather than http 200). That could be its way of saying "there are no updates", but I'm not certain.

Note: the following is my package.json file after running this command. I see it added a new section "dependencies", but only 2 items suggest new versions, and seems to have copied 2. That copying behavior seems odd to me.

{
  "name": "myapp",
  "version": "0.1.0",
  "description": "hello world",
  "devDependencies": {
    "grunt": "~0.4.2",
    "grunt-contrib-clean": "~0.5.0",
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-jshint": "~0.7.2",
    "grunt-contrib-csslint": "~0.2.0",
    "grunt-cordovacli": "~0.3.3",
    "grunt-contrib-concat": "~0.3.0"
  },
  "dependencies": {
    "grunt-contrib-copy": "~0.4.1",
    "grunt-contrib-jshint": "~0.7.2",
    "grunt": "~0.4.4",
    "grunt-cordovacli": "~0.3.4"
  }
}
有帮助吗?

解决方案

It's impossible yet, but it is on the wanted list, see https://github.com/npm/npm/issues/4471

But you can run npm outdated to check which modules have updates, and update them manually one by one. It's a good method, since you can check what changes they have while you're installing them.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top