Nuxt.js: nuxt build fails with spa mode

Created on 6 Oct 2019  ยท  8Comments  ยท  Source: nuxt/nuxt.js

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! [email protected] build: `nuxt build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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)
bug-confirmed bug-report

Most helpful comment

its bug, i`l check what wrong

All 8 comments

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

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

its bug, i`l check what wrong

hmm

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
  ...
}

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

it's appear only on linux.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shyamchandranmec picture shyamchandranmec  ยท  3Comments

mikekidder picture mikekidder  ยท  3Comments

jaredreich picture jaredreich  ยท  3Comments

surmon-china picture surmon-china  ยท  3Comments

vadimsg picture vadimsg  ยท  3Comments