Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm outdated does not list global installed packages #6098

Open
2 tasks done
ItsIgnacioPortal opened this issue Jan 27, 2023 · 9 comments
Open
2 tasks done

[BUG] npm outdated does not list global installed packages #6098

ItsIgnacioPortal opened this issue Jan 27, 2023 · 9 comments
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release

Comments

@ItsIgnacioPortal
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

I have installed [email protected] globally by running npm install -g [email protected]. Running npm help outdated shows me the documentation, which lists global as a valid option. So I tried to run:

npm outdated -g

But it outputs nothing. Running all the possible variations:

npm outdated -g

npm outdated --global

npm outdated global

None of them give any output. I expected to see the available upgrade to [email protected]

Expected Behavior

npm outdated -g
Package     Current  Wanted  Latest  Location                 Depended by
calculator   0.1.11  0.1.12  0.1.12  node_modules/calculator  User

Steps To Reproduce

  1. npm install -g [email protected]
  2. npm outdated -g

Environment

I installed node through nvm 1.1.9

  • npm: 8.19.3
  • Node.js: v16.19.0
  • OS Name: Windows 22H2
  • System Model Name: ?
  • npm config:
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v16.19.0
; npm local prefix = C:\Users\User
; npm version = 8.19.3
; cwd = C:\Users\User
; HOME = C:\Users\User
; Run `npm config ls -l` to show all defaults.
@ItsIgnacioPortal ItsIgnacioPortal added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Jan 27, 2023
@ljharb
Copy link
Contributor

ljharb commented Jan 27, 2023

imo npm outdated -g doesn't really make sense, since there's no global package.json.

@ItsIgnacioPortal
Copy link
Author

ItsIgnacioPortal commented Jan 27, 2023

imo npm outdated -g doesn't really make sense, since there's no global package.json.

The objective of running npm-outdated for global packages is to check if we have the latest version available. Otherwise there is no easy way of checking for updates. This should be supported

@wraithgar
Copy link
Member

I can't reproduce this.

$ npm i -g [email protected]

added 76 packages, and audited 77 packages in 2s

found 0 vulnerabilities
~/D/n/c/b/main (latest|✔) $ npm outdated -g
Package     Current  Wanted  Latest  Location                 Depended by
calculator   0.1.11  0.1.12  0.1.12  node_modules/calculator  global
~/D/n/c/b/main (latest|✔) $ npm -v
8.19.3

Are you using nvs by chance? jasongin/nvs#252

@wraithgar wraithgar added Cannot Reproduce and removed Needs Triage needs review for next steps labels Jan 30, 2023
@ItsIgnacioPortal
Copy link
Author

I can't reproduce this.

$ npm i -g [email protected]

added 76 packages, and audited 77 packages in 2s

found 0 vulnerabilities
~/D/n/c/b/main (latest|✔) $ npm outdated -g
Package     Current  Wanted  Latest  Location                 Depended by
calculator   0.1.11  0.1.12  0.1.12  node_modules/calculator  global
~/D/n/c/b/main (latest|✔) $ npm -v
8.19.3

Are you using nvs by chance? jasongin/nvs#252

Nope. I never installed nvs. I'm using nvm. I'm on windows though. You seem to be on linux

@ljharb
Copy link
Contributor

ljharb commented Jan 31, 2023

nvm-windows, or actual nvm?

@ItsIgnacioPortal
Copy link
Author

nvm-windows, or actual nvm?

nvm-windows

@bestpika
Copy link

bestpika commented Feb 2, 2023

I have a similar problem.
I used nvm-windows and installed node v18.9.0 and npm v9.4.0.
image
Also, this problem has already happened with npm v8.x.
By the way, nvs also has this problem.

@jerone
Copy link

jerone commented Feb 2, 2023

I'm having the same issue.

As part of q-nick/npm-gui#89 I tried to research a little. These are my findings:

Nodejs version v18.11.0.

NPM version 9.4.1.

I also have nvm-windows installed. Version 1.1.10.

Weirdly enough, npm-check-updates does detect updates correctly.

npm outdated -g --all does execute the outdated check, but also for dependencies of dependencies (because that's what --all does).
Sadly npm outdated -g --all --depth=0 did not change the huge list.

npm ls -g --depth=0 does detect all global installed packages correctly.

Click here to see output from npm ls -g --depth=0 --json.
{
  "resolved": "file:../Users/<user>/AppData/Roaming/nvm/v18.11.0",
  "dependencies": {
    "@angular/cli": {
      "version": "15.0.5",
      "overridden": false
    },
    "@cspell/dict-nl-nl": {
      "version": "2.2.8",
      "overridden": false
    },
    "corepack": {
      "version": "0.15.3",
      "overridden": false
    },
    "cspell": {
      "version": "6.18.1",
      "overridden": false
    },
    "generator-code": {
      "version": "1.7.2",
      "overridden": false
    },
    "generator-eslint": {
      "version": "4.1.1",
      "overridden": false
    },
    "generator-jest": {
      "version": "1.8.0",
      "overridden": false
    },
    "generator-sublime": {
      "version": "2.0.13",
      "overridden": false
    },
    "js-to-ts-converter": {
      "version": "0.18.2",
      "overridden": false
    },
    "np": {
      "version": "7.6.3",
      "overridden": false
    },
    "npm-check-updates": {
      "version": "16.6.2",
      "overridden": false
    },
    "npm-gui": {
      "version": "4.0.3",
      "overridden": false
    },
    "npm": {
      "version": "9.2.0",
      "overridden": false
    },
    "web-ext": {
      "version": "7.4.0",
      "overridden": false
    },
    "yarn": {
      "version": "1.22.19",
      "overridden": false
    },
    "yo": {
      "version": "4.3.1",
      "overridden": false
    }
  }
}

My suspicion is that resolved property is not correctly handled in npm outdated -g.

@wraithgar wraithgar added Priority 2 secondary priority issue and removed Cannot Reproduce labels Feb 2, 2023
@segevfiner
Copy link

Happens to me with nvm-windows and fnm on Windows 11.

On Node.js 20.14.0, fnm 1.37, npm 10.8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 2 secondary priority issue Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

6 participants