q-nick/npm-gui

No update check for global packages

jerone opened this issue · 11 comments

When opening npm-gui with global packages, the update check doesn't return anything:

image

There should be updates for:

  • @angular/cli 15.0.5 → 15.1.1
  • npm 9.2.0 → 9.3.0

npm-gui version 4.0.1

Hi @jerone, unfortunately, I can't find any cause for that.

Would you like to share the output of a few additional commands, I need:

npm ls -g --depth=0 --json - will list all your globally installed packages and installed versions

npm outdated -g --json - will show all the latest versions of your global packages - probably this command is somehow broken.

This is the log from npm-gui:

OK: npm ls -g --depth=0 --json
Command: npm --version, started
Command: npm ls -g --depth=0 --json, started
Command: yarn --version, started
Command: pnpm --version, started
OK: npm ls -g --depth=0 --json
Command: npm outdated -g --json, started
OK: npm outdated -g --json
This is 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
    }
  }
}

This is from npm outdated -g --json:

{}

npm-check-updates however, is correctly detecting outdated packages:

 @angular/cli       15.0.5  →  15.1.2
 cspell             6.18.1  →  6.19.2
 npm                 9.2.0  →   9.3.1
 npm-check-updates  16.6.2  →  16.6.3
 web-ext             7.4.0  →   7.5.0

There are similar issues reported:

The last issue mentions the use of nvm, which uses symlink for using the right node.js (and unassumingly also global packages). I'm using https://github.com/coreybutler/nvm-windows/

This also corresponds to this old issue: npm/npm#9564

But then again, npm-check-updates does detect updates correctly.

@jerone I got some idea.

Could you check if you have the newest version under the black button (the one with "=>" mark)?

Weirdly enough, the following command does check for outdated packages and comes back with an huge list of outdated package.
But the list contains the dependencies of dependencies (because that's what --all does):

npm outdated -g --all

Sadly npm outdated -g --all --depth=0 did not change the huge list.

The more I think about this, the more I'm convinced this is an NPM issue.
But I was wondering how your output of npm outdated -g --json looks like...

Great research @jerone !
I will provide, a unique workaround for global dependencies update - based on versions in package details.

Many thanks!

@jerone Hi, I released version 4.0.5-beta-1 which should contain a fix for this problem.

Would you like to confirm?

npx npm-gui@4.0.5-beta-1

Hi @q-nick, I tried it just now, and this is the result:

image

According to ncu I should see two outdated global packages:

PS C:\Users\jerone> ncu -g
[====================] 17/17 100%

 cspell  6.23.0  →  6.26.1
 npm      9.4.2  →   9.5.0
Here is the log from the console when running npx npm-gui@4.0.5-beta-1...
PS C:\Users\jerone> npx npm-gui@4.0.5-beta-1
Need to install the following packages:
  npm-gui@4.0.5-beta-1
Ok to proceed? (y)
listening on: localhost 13377
Command: npm ls -g --depth=0 --json, started
ERROR HANDLER Error: invalid project structure!
    at Object.callback (C:\Users\jerone\AppData\Local\npm-cache\_npx\cb45cb7a4356409f\node_modules\npm-gui\dist\server\index.js:1:10548)
    at K.onIncomingMessage (C:\Users\jerone\AppData\Local\npm-cache\_npx\cb45cb7a4356409f\node_modules\npm-gui\dist\server\index.js:1:9072)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
OK: npm ls -g --depth=0 --json
Command: npm --version, started
Command: npm ls -g --depth=0 --json, started
Command: npm info @angular/cli@15.1.5 --json, started
Command: npm info @cspell/dict-nl-nl@2.2.8 --json, started
Command: npm info @vscode/vsce@2.17.0 --json, started
Command: npm info corepack@0.15.3 --json, started
Command: npm info cspell@6.23.0 --json, started
Command: npm info generator-code@1.7.3 --json, started
Command: npm info generator-eslint@4.1.1 --json, started
Command: npm info generator-jest@1.8.0 --json, started
Command: npm info generator-sublime@2.0.13 --json, started
Command: npm info js-to-ts-converter@0.18.2 --json, started
Command: yarn --version, started
OK: npm info generator-eslint@4.1.1 --json
OK: npm info @angular/cli@15.1.5 --json
OK: npm info corepack@0.15.3 --json
OK: npm info generator-jest@1.8.0 --json
OK: npm info js-to-ts-converter@0.18.2 --json
OK: npm info @cspell/dict-nl-nl@2.2.8 --json
OK: npm info generator-sublime@2.0.13 --json
OK: npm info cspell@6.23.0 --json
OK: npm info generator-code@1.7.3 --json
OK: npm info @vscode/vsce@2.17.0 --json
Command: npm info np@7.6.3 --json, started
Command: npm info npm-check-updates@16.7.4 --json, started
Command: npm info npm-gui@4.0.4 --json, started
Command: npm info npm@9.4.2 --json, started
Command: npm info web-ext@7.5.0 --json, started
Command: npm info yarn@1.22.19 --json, started
Command: npm info yo@4.3.1 --json, started
Command: pnpm --version, started
OK: npm info yo@4.3.1 --json
OK: npm info np@7.6.3 --json
OK: npm info npm-check-updates@16.7.4 --json
OK: npm info web-ext@7.5.0 --json
OK: npm info yarn@1.22.19 --json
OK: npm info npm-gui@4.0.4 --json
OK: npm ls -g --depth=0 --json
Command: npm outdated -g --json, started
OK: npm info npm@9.4.2 --json
OK: npm outdated -g --json

The error at the beginning is correct because I started the tool on an not-project folder.