我已经开发了一个nuxt.js应用程序,当使用nuxt dev
作为构建方法时,该应用程序可以正常工作。但是,当我尝试使用nuxt generate
生成静态页面时,出现错误:
Hash: 206d44a896e029b4cfcd
Version: webpack 3.12.0
Time: 4175ms
Asset Size Chunks Chunk Names
server-bundle.json 343 kB [emitted]
nuxt: Call generate:distRemoved hooks (1) +0ms
nuxt:generate Destination folder cleaned +24s
nuxt: Call generate:distCopied hooks (1) +87ms
nuxt:generate Static & build files copied +87ms
nuxt:render Rendering url /index.vue +0ms
nuxt:render Rendering url / +74ms
nuxt: Call generate:page hooks (1) +1s
nuxt:generate Generate file: \index.html +1s
nuxt:render Rendering url / +1s
nuxt: Call generate:done hooks (1) +54ms
nuxt:generate HTML Files generated in 25.1s +55ms
Generate errors summary:
ROUTE /index.vue
Error: render function or template not defined in component: anonymous
- build.js:7396 normalizeRender
[npm]/[nuxt]/[vue-server-renderer]/build.js:7396:13
- build.js:7520 renderComponentInner
[npm]/[nuxt]/[vue-server-renderer]/build.js:7520:3
- build.js:7491 renderComponent
[npm]/[nuxt]/[vue-server-renderer]/build.js:7491:5
- build.js:7407 renderNode
[npm]/[nuxt]/[vue-server-renderer]/build.js:7407:5
- build.js:7527 renderComponentInner
[npm]/[nuxt]/[vue-server-renderer]/build.js:7527:3
- build.js:7491 renderComponent
[npm]/[nuxt]/[vue-server-renderer]/build.js:7491:5
- build.js:7407 renderNode
[npm]/[nuxt]/[vue-server-renderer]/build.js:7407:5
- build.js:7527 renderComponentInner
[npm]/[nuxt]/[vue-server-renderer]/build.js:7527:3
- build.js:7491 renderComponent
[npm]/[nuxt]/[vue-server-renderer]/build.js:7491:5
- build.js:7407 RenderContext.renderNode
[npm]/[nuxt]/[vue-server-renderer]/build.js:7407:5
- build.js:2428 RenderContext.next
[npm]/[nuxt]/[vue-server-renderer]/build.js:2428:14
- build.js:2441 RenderContext.next
[npm]/[nuxt]/[vue-server-renderer]/build.js:2441:12
- build.js:2287 RenderContext.cachedWrite [as write]
[npm]/[nuxt]/[vue-server-renderer]/build.js:2287:9
- build.js:2432 RenderContext.next
[npm]/[nuxt]/[vue-server-renderer]/build.js:2432:16
- build.js:2287 RenderContext.cachedWrite [as write]
[npm]/[nuxt]/[vue-server-renderer]/build.js:2287:9
- build.js:2432 RenderContext.next
[npm]/[nuxt]/[vue-server-renderer]/build.js:2432:16
nuxt:generate Generate done +51ms
调用nuxt generate
后,此错误显示为终端输出。 'nuxt dev'可以正确构建应用程序,并可以在浏览器中正常运行。
编辑:我刚刚注意到:页面实际上正在构建中,并且可以在浏览器中正常工作!那应该是什么意思?
我不知道此错误可能来自何处,并且由于错误消息未在告诉我,我也不知道我需要在此问题上附加哪些信息以使其可回答。请发表评论,我将对其进行相应的编辑。