magidoc-org / magidoc

Autogenerate static GraphQL API documentation
https://magidoc.js.org
MIT License
243 stars 19 forks source link

error when starting dev server #394

Open burns-brian opened 1 month ago

burns-brian commented 1 month ago

Describe the bug

When running magidoc dev for any project, including the default spacex example, the following error occurs: Error: ENOENT: no such file or directory, realpath '/private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/localhost'. The log says Server listening on http://localhost:3000, but browsers result in a "can't connect to server" error.

Reproduction

Download a copy of magidoc at v6.0.0. Although, I have also experienced this in v4.2.1. Navigate to the spacex example (i.e. cd ~/Downloads/magidoc-main/packages/examples/spacex. Then, run npm i -g @magidoc/cli@6.0.0. Finally, run magidoc dev.

Logs

magidoc dev
✔ Determine tmp directories [0.0s]
✔ Select Package Manager [3s]
↓ Template already unzipped.
↓ Template already unzipped
✔ Install dependencies [0.7s]
✔ Resolving template configuration [0.0s]
✔ Load GraphQL Schema [0.4s]
✔ Copy static assets [0.0s]
✔ Write variables file [0.0s]
Command 'npm' failed with status 1 when executed in directory /var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0

---- Program Output----

> @magidoc/starter-carbon-multi-page@6.0.0 dev
> vite dev localhost 3000

error when starting dev server:
Error: ENOENT: no such file or directory, realpath '/private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/localhost'
    at realpathSync.native (node:fs:2776:18)
    at getRealPath (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:46384:16)
    at getFsUtils (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:46129:68)
    at preAliasPlugin (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:48406:19)
    at resolvePlugins (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:49101:5)
    at resolveConfig (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:66619:28)
    at async _createServer (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/chunks/dep-BcXSligG.js:62977:18)
    at async CAC.<anonymous> (file:///private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0/node_modules/vite/dist/node/cli.js:735:20)

For a more detailed output, run with --stacktrace

-----------

Server listening on http://localhost:3000

System Info

System:
    OS: macOS 14.5
    CPU: (20) arm64 Apple M1 Ultra
    Memory: 1.50 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 21.4.0 - /opt/homebrew/bin/node
    npm: 10.2.4 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 127.0.6533.74
    Edge: 127.0.2651.74
    Safari: 17.5

Severity

Serious, but I can work around it

pelletier197 commented 1 month ago

Sorry, I pasted my previous comment in the wrong issue. So I have tested your reproduction steps and everything works fine for me. The only thing I see is that you're on a Mac. Also, this issue seems to be happening inside svelte. Unfortunately, it will be difficult for me to investigate since I don't own a Mac.

If you have some time on your hands, you could try figuring out what happens by playing inside /private/var/folders/cx/0lwng48n405dwjlp4694b5bc0000gn/T/carbon-multi-page@6.0.0 (the svelte template). Otherwise, I'm afraid this will remain blocked for now.

burns-brian commented 1 month ago

Thanks for your help. I apologize, I meant to show you the contents of that folder.

drwxr-xr-x@ Aug  1 09:35 .
drwx------@ Aug  1 12:08 ..
-rw-r--r--@ Aug  1 09:33 .gitignore
-rw-r--r--@ Aug  1 09:33 .npmrc
drwxr-xr-x@ Aug  1 09:33 .svelte-kit
drwxr-xr-x@ Aug  1 09:33 .vscode
-rw-r--r--@ Aug  1 09:33 README.md
-rw-r--r--@ Aug  1 09:33 magidoc.config.js
drwxr-xr-x@ Aug  1 09:33 node_modules
-rw-r--r--@ Aug  1 09:46 package-lock.json
-rw-r--r--@ Aug  1 09:33 package.json
drwxr-xr-x@ Aug  1 09:33 src
drwxr-xr-x@ Aug  1 09:46 static
-rw-r--r--@ Aug  1 09:33 svelte.config.js
-rw-r--r--@ Aug  1 09:33 tsconfig.json
-rw-r--r--@ Aug  1 09:33 vite.config.ts

I am also attaching a copy of the carbon-multi-page@6.0.0 directory. Please note that I have removed the contents of the node_modules directory in the zip file for space.

carbon-multi-page@6.0.0.zip

TLDR: Basically, it's looking for a localhost folder in carbon-multi-page@6.0.0/localhost that isn't there.