Problem serving dist folder in node.js locally



  • I just built my app that I want to put on a server, but first trying to test locally.
    This is my quasar info:
    0_1538911223821_quasar-info.PNG

    I made a regular spa build knowing that it’s not be sitting directly in root folder on the server, so I changed publicPath:
    0_1538911318127_quasar-conf.PNG

    Static frontpage files are served OK for the main page. The main page has a link pointing to ''http://localhost:3000/application" which produces blank page with this error:
    0_1538911780829_consoleError.PNG

    #q-app does not have any content:
    0_1538912215267_htmlEl.png

    Network tab says connection OK:
    0_1538911814750_network.png

    I put my build in my application folder on the local server and tried to serve it both with express and serve-static library, which produces the same results - blank page. Here is how it looks like inside node:
    0_1538911881384_nodeServer.PNG

    Thank you for any help 🙂



  • Hi. The build, once it’s built, has nothing to do with the dev server. In other words, it’s the dev server setting, which you were changing, so it will have no effect.

    Try out quasar serve at the root of your project. That should fire up a node web server to serve your built site/ application.

    Scott



  • Hi, thanks for the reply. It says it’s been deprecated and to use http-server, but I’m already running nodejs server and trying to serve the build with app.use('/application',serveStatic(__dirname + '/application/dist/spa-mat'));

    0_1538949404200_testServer.PNG



  • @besthost

    It says it’s been deprecated and to use http-server,

    What says it’s been deprecated?

    Scott



  • Says quasar CLI 🙂
    0_1539013575094_depr.PNG

    I figured it out:
    I changed an absolute publicPath to relative like this:
    publicPath: ‘/application’

    That’s all it took to make it work 🙂



  • Ok. At some point you’ll need to upgrade your CLI. You are on version 15 and we are now on version 17.

    Great you’ve solved the problem anyway.

    Scott