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

This module cannot be imported in server runtime || og-image not showing #86

Open
Abdallah-Awwad opened this issue Apr 26, 2024 · 4 comments · May be fixed by #87
Open

This module cannot be imported in server runtime || og-image not showing #86

Abdallah-Awwad opened this issue Apr 26, 2024 · 4 comments · May be fixed by #87

Comments

@Abdallah-Awwad
Copy link
Contributor

Abdallah-Awwad commented Apr 26, 2024

The projects works fine but I'm getting this error whenever I try to rebuild it.

✔ Server built in 96167ms
ℹ Initializing prerenderer

[3:08:01 PM]  ERROR  This module cannot be imported in server runtime. [importing @nuxt/kit from node_modules/.pnpm/nuxt-simple-sitemap@3.4.0_@nuxt+devtools@1.0.8_@vue+compiler-core@3.4.21_jwt-decode@3.1.2_nux_undt3zhfvsokhebtqgy6i27fba/node_modules/nuxt-simple-sitemap/dist/runtime/util/pageUtils.mjs]

ℹ Prerendering 2 routes
  ├─ /__og-image__/font/Inter/700.ttf (55ms)
  ├─ /__og-image__/font/Inter/400.ttf (40ms)
ℹ Prerendered 2 routes in 47.356 seconds
✔ Generated public .output/public                                                                                                                                                                                         
ℹ Building Nuxt Nitro server (preset: node-server)

[3:09:09 PM]  ERROR  This module cannot be imported in server runtime. [importing node_modules/.pnpm/@nuxt+kit@3.10.3/node_modules/@nuxt/kit/dist/index.mjs from node_modules/.pnpm/nuxt-simple-sitemap@3.4.0_@nuxt+devtools@1.0.8_@vue+compiler-core@3.4.21_jwt-decode@3.1.2_nux_undt3zhfvsokhebtqgy6i27fba/node_modules/nuxt-simple-sitemap/dist/runtime/util/pageUtils.mjs]

Also note: after merging this PR #85 the link works as expected (not using the localhost anymore)
<meta property="og:image" content="https://mydomain.com/__og-image__/image/team/og.png">

But the og-image not appearing and gives me this error:
{ "url": "/__og-image__/image/og.png", "statusCode": 500, "statusMessage": "", "message": "Invalid JPEG", "stack": "" }

I'm not sure if they both are related, but any help would be appreciated.

Also, I would like to know where is the og-images stored in my server? because I can't see any of them created in the public path.

I'm selfhosting on Digital Ocean
Node version 20.12.2

@bryantgillespie
Copy link
Contributor

Hmmm - based on the error maybe a dependency issue?

@bryantgillespie
Copy link
Contributor

Have you tried updating dependencies?

@Abdallah-Awwad
Copy link
Contributor Author

Yes, it appears to be a dependency issue. I resolved it by replacing @nuxtjs/sitemap instead of nuxt-simple-sitemap because its deprecated. I will submit a PR for this change.

@Abdallah-Awwad
Copy link
Contributor Author

Regarding the og image, I suspect the issue may be related to the logo.vue component. Because when I replaced logo_on_dark_bg with an SVG image, it worked well in most cases. I plan to debug this further when time allows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants