clouds, sky, summer day

Deploying Nuxt SSR app to Azure Web Apps

Deploying a Nuxt SSR app to azure using the new Github actions took me almost 2 days. Complete hit and miss.

I had created a new app, using the CLI and configured it to be server side rendered.

2021-04-02T16:19:29.429108206Z yarn run start
2021-04-02T16:19:30.186388479Z yarn run v1.17.3
2021-04-02T16:19:30.296331055Z $ nuxt start
2021-04-02T16:19:30.339024738Z /home/site/wwwroot/node_modules/.bin/nuxt: 1: /home/site/wwwroot/node_modules/.bin/nuxt: ../nuxt/bin/nuxt.js: not found
2021-04-02T16:19:30.370674893Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The main error was always about the nuxt command was not found. The app wouldn’t start.

I fixed this with a combination of two changes.

  1. Install a new package just for starting the app – yarn add nuxt-start -D
    • After installing the new package we have to change our package.json file in order to actually use it. We can replace the old start script with:
    • "start": "./node_modules/nuxt-start/bin/nuxt-start.js",
  2. Add a server configuration to our nuxt.config.js file, or modify it to be something like the below:
    • server: { host: '0.0.0.0', port: 8080, },

After this changes I was finally able to successfully see it live! 🥳

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.