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

nuxt build fails with spa mode #6519

Closed
vinayakkulkarni opened this issue Oct 6, 2019 · 8 comments · Fixed by #6525
Closed

nuxt build fails with spa mode #6519

vinayakkulkarni opened this issue Oct 6, 2019 · 8 comments · Fixed by #6525

Comments

@vinayakkulkarni
Copy link

Version

v2.10.0

Reproduction link

https://github.com/vinayakkulkarni/nuxt-2.10-bug

Steps to reproduce

npm install
npm run build

What is expected ?

Nuxt to build all routes and files post build success.

What is actually happening?

ℹ Generating pages                                                                                                                                                                                  18:52:53

 ERROR   /                                                                                                                                                                                          18:52:53

TypeError: Cannot read property 'renderRoute' of undefined
    at Generator.generateRoute (/Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/generator/dist/generator.js:222:42)
    at /Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/generator/dist/generator.js:120:24
    at async Promise.all (index 0)
    at async Generator.generateRoutes (/Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/generator/dist/generator.js:115:7)
    at async Generator.generate (/Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/generator/dist/generator.js:48:20)
    at async Object.run (/Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/cli/dist/cli-build.js:101:5)
    at async NuxtCommand.run (/Users/vinayak/Development/Personal/nuxt/nuxt-2.10-bug/node_modules/@nuxt/cli/dist/cli-command.js:2575:7)


 FATAL  Cannot read property 'renderRoute' of undefined                                                                                                                                             18:52:53

  at Generator.afterGenerate (node_modules/@nuxt/generator/dist/generator.js:168:43)
  at async Generator.generate (node_modules/@nuxt/generator/dist/generator.js:50:5)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-build.js:101:5)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-command.js:2575:7)


   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │   ✖ Nuxt Fatal Error                                           │
   │                                                                │
   │   TypeError: Cannot read property 'renderRoute' of undefined   │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt-2.10-bug@1.0.0 build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt-2.10-bug@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/vinayak/.npm/_logs/2019-10-06T13_22_53_417Z-debug.log

Additional comments?

Related issues: #6500, #6513 & #6514

This bug report is available on Nuxt community (#c9867)
@kajcula
Copy link

kajcula commented Oct 7, 2019

Instead 'npm run build' use 'npm run generate' - for me works fine

@AndrewBogdanovTSS
Copy link

@kajcula it's not a real solution for the problem

@aldarund
Copy link

aldarund commented Oct 7, 2019

its bug, i`l check what wrong

@aldarund aldarund changed the title npm run build fails for nuxt > v2.10 nuxt build fails with spa mode Oct 7, 2019
@ricardogobbosouza
Copy link
Contributor

ricardogobbosouza commented Oct 7, 2019

@aldarund problem its here 95e043f#diff-487be8dbf9747ee9db4e19a779085840R64
server has been set to false

So here it does not exist https://github.com/nuxt/nuxt.js/blob/dev/packages/generator/src/generator.js#L210

The commit that caused this 95e043f

@khanh97dev
Copy link

hmm

@cron13
Copy link

cron13 commented Oct 8, 2019

It affect not only spa mode.
I use universal mode and I have self made page level cache module where i use this.nuxt.renderer - in development everything is ok, but in prod i got TypeError

nuxt.config.js:
modules: [
  '~/modules/page-cache',
],
~/modules/page-cache:
module.exports = function cacheRenderer() {
  const nuxt = this.nuxt
  const cache = makeCache(this.options.cache)
  const renderer = nuxt.renderer
  const renderRoute = renderer.renderRoute.bind(renderer) //TypeError
  ...
}

@aldarund
Copy link

aldarund commented Oct 8, 2019

@cron13 it`s different issue. You need to check for renderer to be exist in your module

@alaxcc
Copy link

alaxcc commented Oct 10, 2019

it's appear only on linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants