Deployment doesn't automatically install dependencies - fails

Hi,

I’m tryiing to deploy a Nuxt.js app as a simple web service. For the build command I entered yarn build as is the default for any Nuxt app. For the start command I entered yarn start as is also a default. However, the deployment fails because “nuxt” is not found, because the dependencies are never installed. I had to change my build command to yarn install && yarn build for it to work.

The other problem I’m having is after the deployment runs yarn start it will start listening on localhost:10000 and the deployment will forever stay “in progress”, the app is at this point also not accessible from the standard domain “.onrender.com” (blank page).

So:

  1. How do I configure the deployment to automatically install deps in the future?
  2. How do I configure the app in render so that the app domain points to my app?
1 Like

Hi elbojoloco,

  1. You should be able to just keep your build command as yarn install && yarn build to guarantee it installs dependencies.

  2. It sounds like you might need to specify the port in your nuxt.config.js file. You might want to try adding the following to that file:

server: {
port: 10000,
host: process.env.NODE_ENV === ‘production’ ? ‘0.0.0.0’ : ‘localhost’
}

Hi @danielle

You should be able to just keep your build command as yarn install && yarn build to guarantee it installs dependencies.

What’s the idea behind having to add the install command in the build phase? Render could have had an installation step, where we mention ‘yarn install’ or npm install, or the dependencies can be installed based on presence of package.json / package-lock.json / yarn-lock.json.

The build step is where you setup your app ready to be run and you have the freedom to run whichever commands you want/need to set up your particular app. We certainly could add some “magic”/detection or extra steps, but to avoid any ambiguity of what is/isn’t going to be run, we leave it to you to get your app environment installed and built as you want.

It can also be nice to put these commands into a script so that it’s tracked in your project, e.g. a render-build.sh in the root of your project

#!/usr/bin/env bash# exit on errorset -o errexitnpm installnpm buildnpm some_other_script_i_want_to_run

Then the build command can be set to ./``render-build.sh

Kind regards

Alan

That does make sense.
I miss the convenience but love the part where I have freedom over which commands to run. :clap:t2:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.