-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Cannot resolve "./resvgjs.android-arm64.node" - Cloudflare Pages #109
Comments
I had a similar error deploying to Vercel, but the error was for the windows package instead of android. |
It seems related to your package manager not installing the correct resvg dependencies for your environment. I think you will need to run the build within the cloudflare page CI |
Building locally with Yarn works fine, building on the cloud causes issues. Both Vercel and Cloudflare also use Yarn by default AFAIK. |
Good to know thanks! Here is a reference to a similar issue: yisibl/resvg-js#153 |
So after some investigating, the problem appears to be the Nitro worker presets for Cloudflare, Vercel and apparently Netlify as well. There are several similar issues on the Nitro repo such as: unjs/nitro#293 Since Not much can be done on this side, it's probably okay to close this one. |
Any updates or possible workarounds for this? |
Unfortunately not. I even tried manually adding the optional dependencies but they still are not recognized during build time. the only option is to generate static files locally and push them to Cloudflare with Wrangler. |
Would you mind sharing some code? Maybe I can implement this as a fallback |
Which NITRO_PRESET do you use? With |
Can you confirm how you're deploying your site? Are you building it locally and deploying or using the Cloudflare Pages CI? I'm not too sure why it thinks the local file exists or why the platform is Android. The relevant logic is here: https://github.com/yisibl/resvg-js/blob/main/js-binding.js I have a playground for Cloudflare pages up that deploys fine but is having some issues rendering the svg -> png. Cloudflare workers seem to work fin (minus the fonts). |
This is my other account (sina-afsharmanesh) that I made for testing CI stuff. I hope you don't mind me replying from this one
There is no code really. The problem is resvg-js picks one of the optional libraries based on the environment. For some reason, the problematic Nitro presets (vercel, cloudflare pages, netlify) don't see them as optional and require all of them. But even if they're all installed manually, Nitro still doesn't find them. I looked further into it, Nitro apparently has problems bundling optional dependencies, as mentioned in the issue I referrenced.
Try SSG rendering with
Currently what seems to work with Cloudflare Pages is SSG rendering locally, then uploading them to cloudflare pages with Wrangler. Normal SSR building seems to fail both locally and on edge with the presets. The Cloudflare Workers preset does work fine, but since Pages came out Cloudflare has been recommending Pages for fullstack apps instead of Workers. I have not tested the Cloudflare Module Workers preset. EDIT: Some corrections. |
I'm getting the error on Cloudflare and local if I use
Works! |
This should be resolved with the latest version of nuxt-og-image / @nuxtseo/module. The v3 major was a complete overhaul of how the bindings work so should be a lot more stable. |
Describe the bug
Im receiving the following error when attempting to build using the official NITRO_PRESET=cloudflare_pages flag for Cloudflare:
Cannot resolve "./resvgjs.android-arm64.node" from "../node_modules/@resvg/resvg-js/js-binding.js" and externals are not allowed!
I had seen a previous bug report opened on this same issue, with a response to use version 1.4.0 of og-images, which I tried as well and can confirm the issue still persists. I tried both with 1.4.0 as well as the latest edition, neither made any difference.
Reproduction
No response
System / Nuxt Info
------------------------------ - Operating System: Linux - Node Version: v16.20.2 - Nuxt Version: 3.7.3 - CLI Version: 3.8.4 - Nitro Version: 2.6.3 - Package Manager: yarn@3.6.3 - Builder: - - User Config: devtools, srcDir, app, modules, css, postcss, build, apollo, runtimeConfig, vite, cloudflareHeaders, site - Runtime Modules: @pinia/nuxt@0.4.11, @nuxtjs/tailwindcss@6.8.0, @nuxtseo/module@2.0.0-beta.31, nuxt-og-image@1.4.0, () - Build Modules: - ------------------------------
The text was updated successfully, but these errors were encountered: