1

I have certain node modules that i want to update. If i run npm outdated i see a list of modules and when i run npm update not all modules are updated.

I still see some in the list when i run npm outdated

my node version is v12.16.2

i see the below list when executing npm outdated

enter image description here

Below are the contents of my package.json

{
  "name": "exporter",
  "version": "1.0.0",
  "description": "api endpoint",
  "main": "server.js",
  "dependencies": {
    "@sentry/node": "5.30",
    "abort-controller": "^3.0.0",
    "archiver": "^5.2.0",
    "aws-sdk": "^2.825.0",
    "body-parser": "^1.19.0",
    "bull": "^3.20.0",
    "bull-board": "^0.9.0",
    "config": "^3.3.3",
    "cors": "^2.8.5",
    "csv": "^5.3.2",
    "dotenv": "^8.2.0",
    "exceljs": "^4.2.0",
    "express": "^4.17.1",
    "express-basic-auth": "^1.2.0",
    "express-rate-limit": "^5.2.3",
    "fs": "0.0.1-security",
    "generic-pool": "^3.7.1",
    "helmet": "^4.3.1",
    "jimp": "^0.16.1",
    "JSONStream": "^1.3.5",
    "jsonwebtoken": "^8.5.1",
    "morgan": "^1.10.0",
    "node-fetch": "^2.6.1",
    "nodemailer": "^6.5.0",
    "pg": "^8.6.0",
    "pg-query-stream": "^4.1.0",
    "pm2": "^4.5.1",
    "puppeteer": "^5.5.0",
    "rate-limit-redis": "^2.0.0",
    "twitter": "^1.7.1",
    "underscore": "^1.12.0",
    "uuid": "^8.3.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "/usr/local/bin/pm2 restart all --update-env"
  },
  "author": "",
  "license": "ISC"
}

How can i update all the below modules, specifically pm2 and puppeteer. Thanks.

opensource-developer
  • 2,826
  • 4
  • 38
  • 88
  • 3
    Can you post the contents of your package.json (particularly any dependencies/dev dependencies)? NPM will only update packages based on the semver version number specified (https://docs.npmjs.com/cli/v6/commands/npm-update - check caret and tilde dependencies). The reason for this is to help reduce the introduction of breaking changes to the codebase. – Bladeski Jun 14 '21 at 08:59
  • thanks @Bladeski, have updated the question with my `package.json` – opensource-developer Jun 14 '21 at 14:05
  • Does this answer your question? [How to update each dependency in package.json to the latest version?](https://stackoverflow.com/questions/16073603/how-to-update-each-dependency-in-package-json-to-the-latest-version) – Bladeski Jun 14 '21 at 14:18

1 Answers1

2

npm update respects semver constraints.

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).

According to the package.json, the constraints are

  • @sentry/node: exact version
  • bull-board, dotenv, pm2, puppeteer: caret range

The packages are up-to-date according to these constraints.

To get the latest versions, you can install packages with the @latest tag.

Note that these are major version updates - things can break.

Hyunbin
  • 423
  • 4
  • 6