nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Nuxt compiler bug in production

Open HugoRCD opened this issue 1 year ago • 5 comments
trafficstars

I created this issue on the main package, but I think it's more appropriate here

https://github.com/vue-email/vue-email/issues/168

HugoRCD avatar Mar 21 '24 15:03 HugoRCD

Running into the exact same problem on Vercel Serverless runtime.

I'm getting these 2 errors at the same time when trying to render a template using useCompiler :

Error: Error rendering template ResetPassword: Error: Component ResetPassword not found
    at templateRender (file:///var/task/node_modules/@vue-email/compiler/dist/index.mjs:57021:11)
    at async useCompiler (file:///var/task/chunks/routes/api/auth/ask-reset-password.post.mjs:34:20)
    at async sendEmail (file:///var/task/chunks/routes/api/auth/ask-reset-password.post.mjs:56:22)
    at async Object.handler (file:///var/task/chunks/routes/api/auth/ask-reset-password.post.mjs:100:3)
    at async Object.handler (file:///var/task/chunks/runtime.mjs:2998:19)
    at async toNodeHandle (file:///var/task/chunks/runtime.mjs:3264:7)
    at async Server.<anonymous> (/opt/node-bridge/bridge-server-CNJTFAIF.js:1:9585)
Error loading component Error: The package "esbuild-linux-64" could not be found, and is needed by esbuild.

If you are installing esbuild with npm, make sure that you don't specify the
"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
of "package.json" is used by esbuild to install the correct binary executable
for your current platform.
    at generateBinPath (/var/task/node_modules/esbuild/lib/main.js:1819:15)
    at esbuildCommandAndArgs (/var/task/node_modules/esbuild/lib/main.js:1886:33)
    at ensureServiceIsRunning (/var/task/node_modules/esbuild/lib/main.js:2051:25)
    at startSyncServiceWorker (/var/task/node_modules/esbuild/lib/main.js:2261:19)
    at Object.<anonymous> (/var/task/node_modules/esbuild/lib/main.js:2302:3)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)

I guess this has something to do with https://github.com/vue-email/nuxt/blob/a6b685a65e14e43a20b28a00066f8613aa30e63e/src/runtime/server/nitro/useCompiler.ts#L14 , but i'm not quite sure what is useStorage here. Is that the one from Nitro and UnStorage ? From my understanding, this is by default some in-memory key-value storage, which then do not make sense in the context of a serverless function ? But that still won't explain why "esbuild-linux-64" won't be found ? I tried to force install it locally on my project but it still wasn't found in Vercel's serverless context.

Gugustinette avatar Mar 29 '24 19:03 Gugustinette

I'm facing the exact same problem

eliabieri avatar Apr 04 '24 14:04 eliabieri

I'm facing the exact same problem as well

dcln00 avatar Apr 11 '24 14:04 dcln00

I had it fixed. Deleted package-lock.json and node modules directory and installed it again fixed it.

dcln00 avatar Apr 11 '24 15:04 dcln00

Fixed here in theory https://github.com/vue-email/vue-email/issues/168

Gugustinette avatar Apr 13 '24 05:04 Gugustinette

we just merged a new project rewrite, please do check the docs and the updated logic https://vuemail.net/

Flowko avatar Jun 22 '24 18:06 Flowko