npm-gui icon indicating copy to clipboard operation
npm-gui copied to clipboard

Falls over on startup, with Error

Open jimrandell opened this issue 2 years ago • 3 comments

Hello, thank you for this utility and the time you have put in! I hope this has all the info you need

Details are below, but first, I have found a work around: If I stop the page loading, as soon as I see it start to draw, I can avoid the error and select my project from the 📁OPEN input! (it will fail again when i try to load Globals)

The Details: when I run: npx npm-gui, the program loads, then fails and returns an error.

  • the utility builds,
  • my browser launches and loads the page,
  • the page stops loading/disappears/turns white
  • the following is returned in the terminal
    • (I have also tried using different ports with no effect)
listening on:  localhost 13377
.css
.js
Command:  npm --version, started:
.woff
Command:  npm ls -g --depth=0 --json, started:
0
Command:  yarn --version, started:
1
Command:  pnpm --version, started:
1
0
OK:
ERROR HANDLER TypeError: Cannot read properties of undefined (reading 'version')
    at Object.getInstalledVersion (C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\utils\mapDependencies.js:89:31)
    at C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\actions\dependencies\get\getGlobalDependencies.js:85:58
    at Array.map (<anonymous>)
    at C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\actions\dependencies\get\getGlobalDependencies.js:81:30
    at step (C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\actions\dependencies\get\getGlobalDependencies.js:33:23)
    at Object.next (C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\actions\dependencies\get\getGlobalDependencies.js:14:53)
    at fulfilled (C:\Users\jimr\AppData\Local\npm-cache\_npx\24be53609d161e5b\node_modules\npm-gui\dist\actions\dependencies\get\getGlobalDependencies.js:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

jimrandell avatar Mar 17 '22 09:03 jimrandell

Hi, @jimrandell you are right. It looks like it crashes on your global dependencies.

Could you post the result of this command: npm ls --depth=0 -g --json it should display exactly what npm-gui is using here.

q-nick avatar Mar 19 '22 12:03 q-nick

hi, sorry, it's a crazy busy time at work right now (why I'm using your tool)

thank you again for your efforts with this project!

Result running command: npm ls --depth=0 -g --json

{
  "name": "npm",
  "dependencies": {
    "@babel/highlight": {
      "version": "7.14.5"
    },
    "@typescript-eslint/eslint-plugin": {
      "version": "5.14.0"
    },
    "blockly": {
      "version": "7.20211209.2"
    },
    "deuglify": {
      "version": "1.0.0"
    },
    "eslint-init": {
      "version": "0.1.12"
    },
    "etc": {},
    "fish": {
      "version": "0.0.0"
    },
    "java": {
      "version": "0.12.2"
    },
    "madge": {
      "version": "5.0.1"
    },
    "mariadb": {
      "version": "2.5.5"
    },
    "npm-cli": {
      "version": "0.1.0"
    },
    "npm": {
      "version": "7.24.0"
    },
    "nw-gyp": {
      "version": "3.6.5"
    },
    "yo": {
      "version": "4.3.0"
    }
  }
}

jimrandell avatar Jul 20 '22 07:07 jimrandell

This happens for me as well, but only after updating npm via npm install npm -g.

GlennSandoval avatar Aug 06 '22 21:08 GlennSandoval

Same here with 4.0.2 running with

  • Windows 10 x64
  • Node.js v18.13.0
  • npm 9.3.1

Here one of the global dependencies is actually missing the version property.

{
  "name": "npm",
  "dependencies": {
    // ...
    "@vercel/ncc": {
      "overridden": false
    },
   // ...
  }
}

Uninstalling it and re-installing it solved the problem:

{
  "name": "npm",
  "dependencies": {
    // ...
    "@vercel/ncc": {
      "version": "0.36.0",
      "overridden": false
    },
   // ...
  }
}

ealib avatar Jan 23 '23 13:01 ealib

@ealib I just released version 4.0.3 which should cover this case. Would you like to confirm if it is better now?

npx npm-gui@latest

q-nick avatar Jan 23 '23 18:01 q-nick

@q-nick I updated to version 4.0.3 and now to 4.0.4 and both keep working, but I don't know how to simulate the old issue with missing version property. I think, however, that if you provided in the code to handle that case, which was clearly the source of the problem, this issue could be closed.

ealib avatar Jan 31 '23 09:01 ealib

@ealib closing, thanks.

q-nick avatar Feb 01 '23 09:02 q-nick