pdfeasy icon indicating copy to clipboard operation
pdfeasy copied to clipboard

Error 500 on Nuxt 3: Cannot read properties of undefined (reading 'userAgent')

Open GuibertLo opened this issue 1 year ago • 4 comments

I followed the installation guidelines for my Nuxt 3 application, and when I add the module in the nuxt.config.ts, I got a 500 error.

at ./pdfeasy:43798:203
at ./pdfeasy:43767:83
at ./pdfeasy:43768:5
at ./pdfeasy:12:32
at ./pdfeasy:44880:28
at ViteNodeRunner.runModule (./node_modules/vite-node/dist/client.mjs:362:11)
at ViteNodeRunner.directRequest (./node_modules/vite-node/dist/client.mjs:346:16)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ViteNodeRunner.cachedRequest (./node_modules/vite-node/dist/client.mjs:189:14)
at async ViteNodeRunner.dependencyRequest (./node_modules/vite-node/dist/client.mjs:233:12)

My package.json dependencies:

"dependencies": {
    "@pinia/nuxt": "^0.5.1",
    "nuxt": "^3.10.3",
    "nuxt-pdfeasy": "^1.4.0",
    "pinia": "^2.1.7",
    "vue": "^3.4.19",
    "vue-router": "^4.3.0",
    "vue-uuid": "^3.0.0"
  },
  "devDependencies": {
    "@nuxt/eslint-config": "^0.2.0",
    "@nuxtjs/i18n": "^8.1.1",
    "eslint": "^8.57.0"
  }

Do someone know how to resolve this problem? Cheers!

GuibertLo avatar Mar 08 '24 16:03 GuibertLo

I'm having this issue too. :-(

Asparagirl avatar Apr 05 '24 01:04 Asparagirl

Same here

BaptisteCrouzet avatar Jul 29 '24 09:07 BaptisteCrouzet

Downgrade my node version to v18 removed this error. 🤞

atmosuwiryo avatar Jul 29 '24 11:07 atmosuwiryo

Some kind of library you use is doing browser detection on the server. Worked around it with:

// nuxt.config.ts
export default defineNuxtConfig({
  nitro: {
    replace: {
      // replace the browser detection in a server lib
      'globalThis.navigator': 'undefined',
      'global.navigator': 'undefined',
    },
  },
})

pegiadise avatar Jan 28 '25 18:01 pegiadise