Closed lxccc812 closed 11 months ago
Hi @lxccc812, are you able to share the live URL or the stack trace thrown by the 500?
This is the log information recorded by pm2 @harlan-zw
[nuxt] [request error] [unhandled] [500] Cannot find module '@resvg/resvg-js-linux-x64-gnu'
Require stack:
- /home/centos/project/frontend/.output/server/node_modules/@resvg/resvg-js/js-binding.js
- /home/centos/project/frontend/.output/server/node_modules/@resvg/resvg-js/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Module.Hook._require.Module.require (/usr/local/nodejs16/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:81:25)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at Module.Hook._require.Module.require (/usr/local/nodejs16/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
Thanks for the log, sorry for the delay.
Not sure what's going on here exactly, you should have the binary installed for you. Can you confirm what package manager you're using and what version (to install the deps).
You can see more about the issue here: https://github.com/yisibl/resvg-js/issues/153
pnpm 8.7.1 package manager What does it mean I should install the binaries and what else do I need to do
Hm maybe you can try manually including the dependency
pnpm add @resvg/resvg-js-linux-x64-gnu
Excessive stack depth comparing types 'NuxtModule
When I tried to use the above method to solve the problem, a new problem arose. When I installed the latest version of nuxt-og-image (2.2.1) and installed it into modules, an error like this was thrown.
But I didn't get this error when using 2.0.28.
nuxt: 3.7.1 nitro: 2.6.3 pnpm: 8.6.7 nuxt-og-image: 2.1.1
After my testing, I found that the version of nuxt-og-image seems to be somewhat incompatible. nuxt(3.7.1) is incompatible with nuxt-og-image(2.1.1) nuxt(3.7.4) is compatible with nuxt-og-image(2.1.1) nuxt(3.7.1) is compatible with nuxt-og-image(2.0.28) nuxt(3.7.4) is compatible with nuxt-og-image(2.0.28)
Problem solving reference Nuxt#13897
In the case of incompatibility, a stack error will occur, and I'm not sure whether this is a bug.
In addition, thank you for your answer. After installing resvg, the problem was solved. However, I think it is a problem that requires me to manually install resvg. Do you have any ideas of merging it into nuxt-og-image?
A new problem has arisen 😫, and what is generated is not an image
pm2 log
template component
<template>
<img src="@/assets/img/og-image.jpg" />
</template>
It's already the easiest thing to use.
nuxt: 3.7.4 nuxt-og-image: 2.1.1
Same issue here when deploying for production on a VPS. I use a docker alpine/node image and copy the .output directory then launch node.
[nuxt] [request error] [unhandled] [500] Cannot find module '@resvg/resvg-js-linux-x64-musl'
Require stack:
- /usr/src/app/server/node_modules/@resvg/resvg-js/js-binding.js
- /usr/src/app/server/node_modules/@resvg/resvg-js/index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1090:15)
at Module._load (node:internal/modules/cjs/loader:934:27)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at Object.<anonymous> (./server/node_modules/@resvg/resvg-js/js-binding.js:1:3256)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
I confirmed the package @resvg/resvg-js-linux-x64-musl
is in server/node_modules
. It works locally but not on the VPS. Quite strange. I'll try and disable nuxt-og-image
in nuxt config for now.
There's a couple of things being pointed out in this issue:
public
dir relative or use absolute)Feel free to open a new issue if you're still having issues.
Describe the bug
I tested it locally without any error messages, but when I deployed it to an online server, a problem occurred when I accessed the page again.
package.json:
Tests I conducted
The online server uses pm2 to manage nuxt projects ecosystem.config.js
Reproduction
I can't provide a replica because the local tests were all fine
System / Nuxt Info