Error deploying nuxt

Hey everyone. I'm trying to deploy a nuxt app in Cloudflare Pages, but im getting the following error when running the build command:
[error] Cannot resolve "canvas" from "/opt/buildhome/repo/node_modules/.pnpm/linkedom@0.15.1/node_modules/linkedom/commonjs/canvas.cjs" and externals are not allowed!
at Object.resolveId (node_modules/.pnpm/nitropack@2.5.2/node_modules/nitropack/dist/shared/nitro.7a525996.mjs:1781:17)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:25256:28)
at async resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:23931:26)
at async ModuleLoader.resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24345:15)
at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:778:16
at async Promise.all (index 0)
at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:770:32
at async rewriteRequireExpressionsAndGetImportBlock (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1346:28)
at async transformCommonjs (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1909:23)
at async transform (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24263:16)
[error] Cannot resolve "canvas" from "/opt/buildhome/repo/node_modules/.pnpm/linkedom@0.15.1/node_modules/linkedom/commonjs/canvas.cjs" and externals are not allowed!
at Object.resolveId (node_modules/.pnpm/nitropack@2.5.2/node_modules/nitropack/dist/shared/nitro.7a525996.mjs:1781:17)
at async PluginDriver.hookFirstAndGetPlugin (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:25256:28)
at async resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:23931:26)
at async ModuleLoader.resolveId (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24345:15)
at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:778:16
at async Promise.all (index 0)
at async node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:770:32
at async rewriteRequireExpressionsAndGetImportBlock (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1346:28)
at async transformCommonjs (node_modules/.pnpm/@rollup+plugin-commonjs@25.0.3_rollup@3.27.0/node_modules/@rollup/plugin-commonjs/dist/es/index.js:1909:23)
at async transform (node_modules/.pnpm/rollup@3.27.0/node_modules/rollup/dist/es/shared/node-entry.js:24263:16)
has anyone seen a similar error? Using Node 18.16.1 and nuxt 3.6.5
1 Reply
ChronicStone
ChronicStone5mo ago
Hi did you manage to solve this N