0

I want to update:

 $ npm outdated -g --depth=0
Package   Current   Wanted  Latest  Location
npm        6.12.1  6.14.18   9.2.0  global
prettier    2.8.1    2.8.2   2.8.2  global

I followed https://stackoverflow.com/a/56806361/8001538 but node npm-cli.js update -g --force doesn't work. It gives this error:

$ node  npm-cli.js update -g --force
internal/modules/cjs/loader.js:895
    throw err;
    ^

Error: Cannot find module '../lib/utils/unsupported.js'
Require stack:
- C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\npm.old\bin\npm-cli.js
←[90m    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:785:27)←[39m
←[90m    at Module.require (internal/modules/cjs/loader.js:956:19)←[39m
←[90m    at require (internal/modules/cjs/helpers.js:74:18)←[39m
    at C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\←[4mnpm.old←[24m\bin\npm-cli.js:19:21
    at Object.<anonymous> (C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\←[4mnpm.old←[24m\bin\npm-cli.js:153:3)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:914:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:822:14)←[39m {
  code: ←[32m'MODULE_NOT_FOUND'←[39m,
  requireStack: [
    ←[32m'C:\\Users\\sunil\\AppData\\Roaming\\nvm\\v13.1.0\\node_modules\\npm.old\\bin\\npm-cli.js'←[39m
  ]
}
Sunil Kumar Das
  • 372
  • 1
  • 2
  • 12
  • The official answer from the Node and npm teams is that you need to fully remove and reinstall Node. This seems to possibly be an issue with large jumps in Node and npm version (the versions you're on are quite old and unsupported). – Zac Anger Jan 08 '23 at 07:01
  • @ZacAnger I understand, but I need `nvm` specific solution. – Sunil Kumar Das Jan 08 '23 at 07:08
  • 1
    The solution is the same with or without NVM — you need to completely uninstall, then reinstall. – Zac Anger Jan 08 '23 at 07:09

0 Answers0