q-nick/npm-gui

Folder without package.json

jerone opened this issue · 6 comments

When starting up npm-gui it opened on my user home dir. This folder doesn't have an package.json or any packages installed as it's not an project folder.

This results in the following error in the console:

Command: npm ls -g --depth=0 --json, started
ERROR HANDLER Error: invalid project structure!
    at Object.projectPathAndManagerMiddleware [as callback] (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\middlewares\project-path-and-manager.middleware.js:31:15)
    at Server.<anonymous> (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:126:62)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERROR HANDLER Error: invalid project structure!
    at Object.projectPathAndManagerMiddleware [as callback] (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\middlewares\project-path-and-manager.middleware.js:31:15)
    at Server.<anonymous> (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:126:62)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

There is also an infinity throbber rotating around the screen:

npm-gui

Happens in Firefox, Edge & Chrome.
Version 4.0.1

Hi, @jerone thanks for the feedback.

As a workaround - try to open any project with package.json like here: https://npm-gui.nullapps.dev/docs/npm-gui/3-navigating/

Actually, I tried navigating up the tree (../), but that resulted in the following error:

ERROR HANDLER Error: EPERM: operation not permitted, lstat 'C:\Users\/DefaultAppPool'
    at lstatSync (node:fs:1574:3)
    at C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\actions\explorer\explorer.js:19:41
    at Array.map (<anonymous>)
    at Object.explorer [as callback] (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\actions\explorer\explorer.js:17:54)
    at Server.<anonymous> (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:142:54)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\<user>\AppData\Roaming\nvm\v18.11.0\node_modules\npm-gui\dist\simple-express.js:5:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  errno: -4048,
  syscall: 'lstat',
  code: 'EPERM',
  path: 'C:\\Users\\/DefaultAppPool'
}

With an empty navigation menu:
image

Looks like an path issue on Windows.

Looks like some problems with filesystem permission.

Does it work if you start npx npm-gui inside the folder with package.json?

Yes, project folders work fine.

@jerone v4.0.2 should contain a fix for that problem. Would you like to confirm if is it better now?

npx npm-gui@latest

Yes, perfect.

image