Open iwolfs opened 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?
Just tested with a fresh clone, everything is running as expected. Please provide some more information.
Cheers!
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
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
More deep tests revealed a pattern:
If i ran 'npm i' on mac - the error is reproduce
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
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 ?
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.
why the page is empty after run build and start:prod?