question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'headers' of undefined after Nuxt Generate

See original GitHub issue

Hello, another error appears after run npm run generate.

Steps:

  1. try create a new nuxt project like: vue init vuetifyjs/nuxt my-project then npm install or yarn

  2. install this nuxt-i18n plugin: yarn add nuxt-i18n then add some configuration to nuxt.config.js.

  3. npm run dev works fine.

  4. npm run generate shows many errors: like this:

 ROUTE  /en/pages/about

  TypeError: Cannot read property 'headers' of undefined

  - server-bundle.js:5621 module.exports.__webpack_exports__.default
    server-bundle.js:5621:43

  - server-bundle.js:1902 promisify
    server-bundle.js:1902:15

  - server-bundle.js:1883 middlewareSeries
    server-bundle.js:1883:10

  - server-bundle.js:5465 module.exports.__webpack_exports__.default
    server-bundle.js:5465:81
  1. im sure that the errors from this plugin, i have disabled it from nuxt.config.js, and re run npm run generate and everything works fine.

  2. is this plugin works with npm run generate ?

any help!

<div align="right">This question is available on Nuxt.js community (#c43)</div>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:31

github_iconTop GitHub Comments

7reactions
mk-toolcommented, Jan 29, 2019

I could solve this problem to check req value.

if(req && req.headers && req.headers.cookie){
  // your code
}
0reactions
waxiao1214commented, Aug 1, 2021

I could solve this problem to check req value.

if(req && req.headers && req.headers.cookie){
  // your code
}

Could you get cookie with this. I tried to get cookie from the header, But req is undefinded. that is working in my local, But After deploying to the netlify It didn’t work

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'headers' of undefined after Nuxt Generate
Hello, another error appears after run npm run generate. Steps: try create a new nuxt project like: vue init vuetifyjs/nuxt my-project then ...
Read more >
NuxtJs - Cannot read property 'headers' of undefined
I'm a newbie in NuxtJs. I'm trying to implement an external API Call with axios which I get token and store it on...
Read more >
Cannot read property 'headers' of undefined when i run npm ...
Im using nuxtjs when i run npm run generate im getting this message: nuxt:render error occurred when calling nuxtServerInit: Cannot read property 'headers' ......
Read more >
NuxtJs - Cannot read property 'headers' of undefined-Vue.js
Acording to Nuxt Docs req is not available on nuxt generate. You should use nuxt build and than nuxt start after that.
Read more >
The error of deploying the product developed with nuxtjs to ...
I'm still working on my Nuxt.js skills. Perhaps this might help Cannot read property 'headers' of undefined after Nuxt Generate · Issue #53...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found