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

dev fails because of astro #1064

Open
Jessewb786 opened this issue Dec 20, 2024 · 4 comments
Open

dev fails because of astro #1064

Jessewb786 opened this issue Dec 20, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Jessewb786
Copy link

I tried this:

Tried to run "dev": "eventcatalog dev" on a clean event-catalog after an npm install.

The issue seems to be regarding @astrojs/mdx not being imported.

This happened:

/Users/john_doe/.nvm/versions/node/v20.16.0/bin/npm run dev

> [email protected] dev
> eventcatalog dev

Setting up EventCatalog....
EventCatalog is starting at http://localhost:3000/docs
[astro] 11:21:17 AM [vite] Error when evaluating SSR module /Users/john_doe/Project/event-catalog/.eventcatalog-core/astro.config.mjs: failed to import "@astrojs/mdx"
[astro] |- Error: Cannot find module '@astrojs/mdx' imported from '/Users/<user>/Project/event-catalog/.eventcatalog-core/astro.config.mjs'
[astro]     at nodeImport (file:///Users/<user>/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53047:19)
[astro]     at ssrImport (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52914:22)
[astro]     at eval (/Users/john_doe/Project/event-catalog/.eventcatalog-core/astro.config.mjs:5:37)
[astro]     at async instantiateModule (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:52972:5)
[astro] 
[astro] [astro] Unable to load your Astro config
[astro] 
[astro] Cannot find module '@astrojs/mdx' imported from '/Users/john_doe/Project/event-catalog/.eventcatalog-core/astro.config.mjs'
[astro]   Location:
[astro]     /Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53047:19
[astro]   Stack trace:
[astro]     at nodeImport (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:53047:19)
[astro]     at eval (/Users/john_doe/Project/event-catalog/.eventcatalog-core/astro.config.mjs:5:37)
[astro] npx astro dev  exited with code 1
[
  {
    command: Command {
      close: [Subject],
      error: [Subject],
      stdout: [Subject],
      stderr: [Subject],
      timer: [Subject],
      killed: false,
      exited: true,
      index: 0,
      name: 'astro',
      command: 'npx astro dev ',
      prefixColor: '',
      env: [Object],
      cwd: '/Users/john_doe/Project/event-catalog/.eventcatalog-core',
      killProcess: [Function (anonymous)],
      spawn: [Function (anonymous)],
      spawnOpts: [Object],
      process: undefined,
      pid: 79660,
      stdin: [Socket]
    },
    index: 0,
    exitCode: 1,
    killed: false,
    timings: {
      startDate: 2024-12-20T10:21:15.482Z,
      endDate: 2024-12-20T10:21:17.537Z,
      durationSeconds: 2.054959167
    }
  }
]

Process finished with exit code 0

I expected this:

I, of course, expected the service to start-up normally on port 3000.

Is there a workaround?

No response

Anything else?

No response

EventCatalog Version

"@eventcatalog/core": "2.18.5"

Node.js Version

v20.16.0

Platform(s)

MacOS

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@Jessewb786 Jessewb786 added the bug Something isn't working label Dec 20, 2024
@boyney123
Copy link
Collaborator

Hey @Jessewb786

Thanks for sharing this.

We have seen a few issues with this recently (check on Discord for convo)

Can you try this https://www.eventcatalog.dev/docs/development/guides/upgrading#having-problems

(Delete node_modules, lock files, .eventcatalog-core) and try again?

@Jessewb786
Copy link
Author

Jessewb786 commented Dec 20, 2024

@boyney123 Unfortunately, after trying that, I still get the following:

Setting up EventCatalog....
EventCatalog is starting at http://localhost:3000/docs
[astro] 14:51:31 [types] Generated 1ms
[astro] 14:51:31 [WARN] [vite] Failed to resolve dependency: react-compiler-runtime, present in client 'optimizeDeps.include'
[astro] 14:51:31 [ERROR] [UnhandledRejection] Astro detected an unhandled rejection. Here's the stack trace:
[astro] TypeError: fsevents.watch is not a function
[astro]     at createFSEventsInstance (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28338:25)
[astro]     at setFSEventsListener (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28394:16)
[astro]     at FsEventsHandler._watchWithFsEvents (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28598:18)
[astro]     at FsEventsHandler.initWatch (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28674:23)
[astro]     at FsEventsHandler._addToFsEvents (file:///Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28763:12)
[astro]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[astro]   Hint:
[astro]     Make sure your promises all have an `await` or a `.catch()` handler.
[astro]   Error reference:
[astro]     https://docs.astro.build/en/reference/errors/unhandled-rejection/
[astro]   Stack trace:
[astro]     at /Users/john_doe/Project/event-catalog/.eventcatalog-core/Users/john_doe/Project/event-catalog/node_modules/vite/dist/node/chunks/dep-BZMjGe_U.js:28338:25
[astro]     [...] See full stack trace in the browser, or rerun with --verbose.
[astro] 

P.S: Everything works fine again if I rollback to 2.16.6. The problem starts specifically with 2.17.0 with the introduction of Astro 5.

@eps90
Copy link

eps90 commented Dec 31, 2024

I also encountered this problem and I noticed it fails when project's package.json has a property type set to module, as I have some additional scripts there. Having that property on, npm install does not install all packages, including @astrojs/mdx. Bringing back package.json to look the same as the generated one fixes the problem (but doesn't fix ability to use modules in node.js). Tested on the latest 2.18.5 version

@Jessewb786
Copy link
Author

@eps90 Indeed, and what I find myself having to do is make everything is lazily computed so that when astro starts with the eventcatalog.config.js, it doesn't compute everything.

And then I still have the issue that I have dynamically resolved generators in my eventcatalog.config.js which are not needed when I run dev, so then I have this frankly sad if check:

if (scriptDirectory.endsWith(".eventcatalog-core")) {
 return [];
} else {
...
}

This lets me run the generate from package.json and also lets me run dev.

I would love to know if there is some other way of integrating dynamically resolved generators.
And they're dynamically resolved because they rely on a series of folders that contain spec files that are the output of yamlinc which stitches together components that are reused across multiple spec files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants