raukaute / vue-hackernews-3.0

HackerNews clone built with Vue 3.0, vue-router@next & vuex@next, with server-side rendering
73 stars 13 forks source link

the page is empty after run build and start:prod #3

Open iwolfs opened 3 years ago

iwolfs commented 3 years ago

why the page is empty after run build and start:prod?

DenniLa2 commented 3 years ago

In terminal:

> vue3-ssr-boilerplate@1.0.0 start:prod /Volumes/MacData500/Test/vue/vue-hackernews-3.0
> cross-env NODE_ENV=production node server

Server started at localhost:8080
[Vue warn]: Component  is missing template or render function.
[Vue warn]: Component  is missing template or render function.

How to fix this?

raukaute commented 3 years ago

Just tested with a fresh clone, everything is running as expected. Please provide some more information.

Cheers!

iwolfs commented 3 years ago

It's ok with 'npm run build' , 'npm run start:prod' But the running page has the following problems in the termical: `> vue3-ssr-boilerplate@1.0.0 start:prod /Users/iwolf/Devs/vue/vue-hackernews-3.0

cross-env NODE_ENV=production node server

Server started at localhost:8080 [Vue warn]: Component is missing template or render function. [Vue warn]: Component is missing template or render function.`

Then, the page is empty in browser, and no questions were raised

environmental information: node v14.15.4 npm v6.14.10 macOS 10.15.6

DenniLa2 commented 3 years ago

mac os: 10.15.5 node: 14.13.0 npm: 6.14.8

windows 10 node: 14.15.5 npm: 6.14.11

In this cases ok with 'npm run start:dev' and 'npm run build'. But when 'npm start:prod' 'npm run start:prod' in terminal this:

dm@Dennis-iMac hackernews-ssr-2-2 % npm run start:prod 

> vue3-ssr-boilerplate@1.0.0 start:prod /Volumes/MacData500/Test/vue/hackernews-ssr-2-2
> cross-env NODE_ENV=production node server

Server started at localhost:8080
[Vue warn]: Component  is missing template or render function.

========= ubuntu 18.4 node: 15.8.0 npm: 7.5.1

All work fine

DenniLa2 commented 3 years ago

More deep tests revealed a pattern:

If i ran 'npm i' on mac - the error is reproduce

raukaute commented 3 years ago

I just ran into (probably) the same problem with another project (created with vue/cli without SSR). In case you're using <script setup> in your root App component, change it to "normal" <script> and see if the problem persists. At least on my side I could fix the problem e.g. the App also gets rendered in the production build.

I opened an issue in the vue/cli repo. Trying to figure out what goes wrong in the compiler meanwhile.....

Cheers

sidkr commented 3 years ago

I just ran into (probably) the same problem with another project (created with vue/cli without SSR). In case you're using <script setup> in your root App component, change it to "normal" <script> and see if the problem persists. At least on my side I could fix the problem e.g. the App also gets rendered in the production build.

I opened an issue in the vue/cli repo. Trying to figure out what goes wrong in the compiler meanwhile.....

Cheers

Changing the script to as you suggested now makes the npm run build step fail. Is there any other change you had to make ? Ex: Major bumping dependencies etc ?

sidkr commented 3 years ago

In terminal:

> vue3-ssr-boilerplate@1.0.0 start:prod /Volumes/MacData500/Test/vue/vue-hackernews-3.0
> cross-env NODE_ENV=production node server

Server started at localhost:8080
[Vue warn]: Component  is missing template or render function.
[Vue warn]: Component  is missing template or render function.

How to fix this?

In package.json version lock all dependencies and devDependencies. Remove the ^ and reinstall again. Worked for me.