Failed deploy on app Nodejs.

TLThiago Lordello5/13/2023
Hi guys. I'm having a prpoblems when try to deploy my aplicattion NodeJs. I change my version of Node but isnt sucess. Can you helpe me ?
TLThiago Lordello5/13/2023
12e388d8-83af-4dfe-aeef-72a222fb5503
Rrando5/13/2023
post your build logs please
TLThiago Lordello5/13/2023
Okay rando. Thanks
TLThiago Lordello5/13/2023
This is my last log building : ==============
Using Nixpacks
==============
context: d18b5c9a5c8bc06c618f0282684d9008

╔══════ Nixpacks v1.5.1 ═════╗
║ build │ npm install ║
║────────────────────────────║
║ start │ npm run start ║
╚════════════════════════════╝


#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.1s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.50kB done
#2 DONE 0.1s


#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678752204
#3 DONE 0.1s


#4 [1/5] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678752204@sha256:fba77818e57bebd4e7a02f60d45554354d6ec5a3f7d98b4ee4f6b2a6e720191e
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 116.28kB done
#5 DONE 0.1s

#6 [2/5] WORKDIR /app/
#6 CACHED

#7 [3/5] COPY . /app/.
#7 DONE 0.0s


#8 [4/5] RUN npm install

#8 0.299 /bin/bash: line 1: npm: command not found
#8 ERROR: process "/bin/bash -ol pipefail -c npm install" did not complete successfully: exit code: 127
-----
[4/5] RUN npm install:
#8 0.299 /bin/bash: line 1: npm: command not found
-----

Dockerfile:15
-------------------
13 | # build phase
14 | COPY . /app/.
15 | >>> RUN npm install
16 |
17 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm install" did not complete successfully: exit code: 127

Error: Docker build failed


Showing 62 logs
TLThiago Lordello5/13/2023
I try to command 'yarn run build' but is not sucess : ╔══════ Nixpacks v1.5.1 ══════╗
║ build │ yarn run build ║
║─────────────────────────────║
║ start │ npm run start ║
╚═════════════════════════════╝


#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.50kB done

#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 transferring context: 2B done

#2 DONE 0.2s

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678752204

#3 DONE 0.1s

#4 [stage-0 1/8] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678752204@sha256:fba77818e57bebd4e7a02f60d45554354d6ec5a3f7d98b4ee4f6b2a6e720191e
#4 DONE 0.0s

#5 [stage-0 2/8] WORKDIR /app/
#5 CACHED

#6 [internal] load build context
#6 transferring context: 116.28kB done
#6 DONE 0.1s


#7 [3/5] COPY . /app/.
#7 DONE 0.1s

#8 [4/5] RUN yarn run build

#8 0.377 /bin/bash: line 1: yarn: command not found
#8 ERROR: process "/bin/bash -ol pipefail -c yarn run build" did not complete successfully: exit code: 127

-----
[4/5] RUN yarn run build:
#8 0.377 /bin/bash: line 1: yarn: command not found
-----

Dockerfile:15
-------------------
13 | # build phase
14 | COPY . /app/.
15 | >>> RUN yarn run build
16 |
17 |
-------------------
ERROR: failed to solve: process "/bin/bash -ol pipefail -c yarn run build" did not complete successfully: exit code: 127

Error: Docker build failed


Showing 64 logs
Bbrody5/13/2023
can you share your repo?
TLThiago Lordello5/13/2023
Yes m, I can Brody.
Bbrody5/13/2023
you do not have a package.json and package-lock.json
add those files, and then define any build or start commands in the scripts fields
remove the build and start commands you have set in the service settings
and read this docs page please
https://docs.railway.app/troubleshoot/fixing-common-errors
TLThiago Lordello5/13/2023
I was trying find documentation from deploy on site railway but I don’t found. Ten minutes ago I throughout. In the moment i go to barber shop. When I arrive my home. I’m try again.
TLThiago Lordello5/13/2023
Thanks for help me Brody
Bbrody5/13/2023
follow those instructions, and it should be good
TLThiago Lordello5/13/2023
Okay Brody. I will try make your sugestions.
TLThiago Lordello5/13/2023
Hey Brody. I repeat all process of commits and install npm. packagelock.json and Node Modules there are in my github, but the deploy failed again.
Bbrody5/13/2023
havent done everything
TLThiago Lordello5/13/2023
Okay i see document. Thanks
Bbrody5/13/2023
okay full build logs please, in a .txt file
TLThiago Lordello5/13/2023
Okay Brody. Im sending to you in seconds
TLThiago Lordello5/13/2023
delpoy falied
Bbrody5/13/2023
i know
TLThiago Lordello5/13/2023
Bbrody5/13/2023
as i have said before
remove the build and start commands you have set in the service settings
TLThiago Lordello5/13/2023
okay
TLThiago Lordello5/13/2023
in settings of the site or my files ?
Bbrody5/13/2023
in the railway service
TLThiago Lordello5/13/2023
okay
TLThiago Lordello5/13/2023
i will remove noe
TLThiago Lordello5/13/2023
now
Bbrody5/13/2023
now i see you have a seed and a setdb script, do either of theses need to be ran when deploying to railway?
TLThiago Lordello5/13/2023
Oh my god. Its up
TLThiago Lordello5/13/2023
thank you guy
TLThiago Lordello5/13/2023
very good
TLThiago Lordello5/13/2023
Yes i have this commands
TLThiago Lordello5/13/2023
but this commands it is set db
Bbrody5/13/2023
but should railway be running them before starting your app?
Bbrody5/13/2023
or is start all that railway needs to run?
TLThiago Lordello5/13/2023
II can't say. When I installed it again I ran the commands afterwards in my terminal by 'railway run npx sequelize-cli db:seed:all' and then the database was populated.
Bbrody5/13/2023
okay sounds good, anything else i can help with?
TLThiago Lordello5/13/2023
I have a doubt. This database that is on my dashboard was linked to the other deploy that I deleted. Now that we've uploaded this new one, will it work with this new back end that we've uploaded now?
Bbrody5/13/2023
is the database in the same project as the service you just deployed to?
TLThiago Lordello5/13/2023
Yes
Bbrody5/13/2023
have you setup the database variable references for your service that you just deployed to?
TLThiago Lordello5/13/2023
In hte past, i set old url. But now i imagine for resolving connection i will change new url . Is correct ?
Bbrody5/13/2023
show me a screenshot of the service variables please
TLThiago Lordello5/13/2023
sure
TLThiago Lordello5/13/2023
this is variables in my database
TLThiago Lordello5/13/2023
No sory
Bbrody5/13/2023
???
TLThiago Lordello5/13/2023
it is variables of backend
TLThiago Lordello5/13/2023
im idiot
Bbrody5/13/2023
^
TLThiago Lordello5/13/2023
this is variables
Bbrody5/13/2023
screenshot of service variables please
Bbrody5/13/2023
don't do that
Bbrody5/13/2023
never show the credentials
TLThiago Lordello5/13/2023
Sory
Bbrody5/13/2023
screenshot of service variables please, and if it didn't go without saying, keep the values hidden
Bbrody5/13/2023
^
TLThiago Lordello5/13/2023
okay. But are you telling me to show you the variables I just showed you?
Bbrody5/13/2023
no
Bbrody5/13/2023
I want to see the service variables
Bbrody5/13/2023
keyword: service
Bbrody5/13/2023
what you showed me was a screenshot of the database plugin
TLThiago Lordello5/13/2023
In these tabs, which would be the tab where the service is?
Bbrody5/13/2023
the variables are in tab that says variables
Bbrody5/13/2023
open the service and click variables
TLThiago Lordello5/13/2023
TLThiago Lordello5/13/2023
this its ?
Bbrody5/13/2023
there we go
Bbrody5/13/2023
yep everything looks good there, you will only nee to reference those variable names when accessing the environment variables in code
TLThiago Lordello5/13/2023
Okay brody.
TLThiago Lordello5/13/2023
Reference in my backend node correct ?
Bbrody5/13/2023
that is the backend service, so yeah that's where you would be using the database
TLThiago Lordello5/13/2023
yes i put the informations on my file config.json
TLThiago Lordello5/13/2023
VEry very thak you.
TLThiago Lordello5/13/2023
For help me.
Bbrody5/13/2023
no problem!
TLThiago Lordello5/13/2023
Goood
TLThiago Lordello5/13/2023
Good night for you