Skip to content
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

SSR + mobileDetect plugin = failed #112

Closed
wokalek-work opened this issue Mar 29, 2022 · 1 comment
Closed

SSR + mobileDetect plugin = failed #112

wokalek-work opened this issue Mar 29, 2022 · 1 comment

Comments

@wokalek-work
Copy link

If I put ssr: false in nuxt config, it's generate fine.

If I do not place ssr: false, it's failed.

Seems like problem in this line: userAgent = this.ctx.req.headers["user-agent"].

What should I do?
I run npm run build, then npm run generate.

Error output
 + 26 hidden assets
Entrypoint app = server.js server.js.map

 WARN  [pwa] [icon] Icon not found in C:\Work\mosoblcom\nuxt\static\icon.png     

i Full static generation activated                                     12:11:09
i Generating output directory: nuxt/                                   12:11:09
i Generating pages with full static mode                               12:11:09

 ERROR   /company                                                      12:11:09  

TypeError: Cannot read properties of undefined (reading 'headers')
    at new MobileDetect (node_modules/.cache/nuxt/nuxt-mobile-detect/mobileDetect.js:11:0)
    at nuxt_mobile_detect_plugin (node_modules/.cache/nuxt/nuxt-mobile-detect/plugin.js:4:0)
    at createApp (node_modules/.cache/nuxt/index.js:230:0)
    at async module.exports.__webpack_exports__.default (node_modules/.cache/nuxt/server.js:85:0)


 ERROR   /contacts                                                     12:11:09  

TypeError: Cannot read properties of undefined (reading 'headers')
    at new MobileDetect (node_modules/.cache/nuxt/nuxt-mobile-detect/mobileDetect.js:11:0)
    at nuxt_mobile_detect_plugin (node_modules/.cache/nuxt/nuxt-mobile-detect/plugin.js:4:0)
    at createApp (node_modules/.cache/nuxt/index.js:230:0)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at listOnTimeout (node:internal/timers:528:9)
    at processTimers (node:internal/timers:502:7)
    at async module.exports.__webpack_exports__.default (node_modules/.cache/nuxt/server.js:85:0)


 ERROR   /portfolio                                                    12:11:09  

TypeError: Cannot read properties of undefined (reading 'headers')
    at new MobileDetect (node_modules/.cache/nuxt/nuxt-mobile-detect/mobileDetect.js:11:0)
    at nuxt_mobile_detect_plugin (node_modules/.cache/nuxt/nuxt-mobile-detect/plugin.js:4:0)
    at createApp (node_modules/.cache/nuxt/index.js:230:0)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at listOnTimeout (node:internal/timers:528:9)
    at processTimers (node:internal/timers:502:7)
    at async module.exports.__webpack_exports__.default (node_modules/.cache/nuxt/server.js:85:0)


 ERROR   /                                                             12:11:09  

TypeError: Cannot read properties of undefined (reading 'headers')
    at new MobileDetect (node_modules/.cache/nuxt/nuxt-mobile-detect/mobileDetect.js:11:0)
    at nuxt_mobile_detect_plugin (node_modules/.cache/nuxt/nuxt-mobile-detect/plugin.js:4:0)
    at createApp (node_modules/.cache/nuxt/index.js:230:0)
    at runNextTicks (node:internal/process/task_queues:61:5)
    at processTimers (node:internal/timers:499:9)
    at async module.exports.__webpack_exports__.default (node_modules/.cache/nuxt/server.js:85:0)

√ Client-side fallback created: 200.html                               12:11:09  
√ Static manifest generated                                            12:11:
@DamianGlowala
Copy link
Collaborator

As Nuxt 2 has reached End of Life (https://nuxt.com/blog/nuxt2-eol), this issue will now be closed. Please feel free to comment or create a new one if it is still relevant in the Nuxt 3 version of this module.

@DamianGlowala DamianGlowala closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants