a year ago
Hello, I'm trying to deploy my full stack application and I need to run a "npm install --legacy-peer-deps" command but I can see that the install command for npm ci is not working. How can I customize my app so that the install command uses "--legacy-peer-deps"?
[Region: us-west1]
==============
Using Nixpacks
==============
context: fc029cd89429944b9ded3d01d0587c58
╔══════════════════════ Nixpacks v1.21.2 ══════════════════════╗
║ setup │ nodejs18, npm-8x ║
║──────────────────────────────────────────────────────────────║
║ install │ npm ci ║
║──────────────────────────────────────────────────────────────║
║ build │ npm install --legacy-peer-deps && npm run build ║
║──────────────────────────────────────────────────────────────║
║ release │ npm run db:import ║
║──────────────────────────────────────────────────────────────║
║ start │ npm start ║
╚══════════════════════════════════════════════════════════════╝
0 building with "default" instance using docker driver
1 [internal] load build definition from Dockerfile
1 transferring dockerfile: 2.34kB done
1 DONE 0.0s
2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1707782610
2 DONE 0.1s
3 [stage-0 1/16] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1707782610@sha256:8f4b0fd95dc3311cf9a59f236d8d7d7f956fe21a2a1d64b53c82f12c4e859f09
3 DONE 0.0s
4 [internal] load .dockerignore
4 transferring context: 2B done
4 DONE 0.0s
5 [internal] load build context
5 transferring context: 4.72MB 0.0s done
5 DONE 0.1s
6 [stage-0 2/16] WORKDIR /app/
6 CACHED
7 [stage-0 3/12] COPY .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix
7 CACHED
8 [stage-0 4/12] RUN nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d
8 CACHED
9 [stage-0 5/12] COPY . /app/.
9 DONE 0.0s
10 [stage-0 6/12] RUN --mount=type=cache,id=s/5af59353-ef55-4c93-a4da-822c382cdcdc-/root/npm,target=/root/.npm npm ci
10 0.618 npm
WARN config production Use --omit=dev
instead.
10 1.704 npm WARN ERESOLVE overriding peer dependency
10 1.705 npm WARN While resolving: @reach/auto-id@0.18.0
10 1.705 npm WARN Found: react@18.2.0
10 1.705 npm WARN node_modules/react
10 1.705 npm WARN react@"^18.2.0" from the root project
10 1.705 npm WARN 8 more (@react-google-maps/api, react-datetime, react-dom, …)
10 1.705 npm WARN
10 1.706 npm WARN Could not resolve dependency:
10 1.706 npm WARN peer react@"^16.8.0 || 17.x" from @reach/auto-id@0.18.0
10 1.706 npm WARN node_modules/@reach/auto-id
10 1.706 npm WARN @reach/auto-id@"0.18.0" from @reach/combobox@0.18.0
10 1.706 npm WARN node_modules/@reach/combobox
ⓘ Deployment information is only viewable by Project members and Railway admins.
46 Replies
a year ago
Please don't set the install command in the build command field, that's not quite how it works, remove that custom build command, then add this nixpacks.toml
file to your project -
[phases.install]
cmds = ['npm install --legacy-peer-deps']
But ideally, you would properly fix the peer dependency issue(s).
a year ago
Got it thank you, would I just remove the other files and then create a new file nixpacks.toml with just that code only?
a year ago
Other files?
It also looks like you are going to be running a development server on Railway, if so, that is going to be costly and unstable.
a year ago
Ah sorry nevermind, so I put in the nixpacks.toml file to the root of my project and getting a different error now!
[Region: us-west1]
==============
Using Nixpacks
==============
context: fc029cd89429944b9ded3d01d0587c58
╔══════════════ Nixpacks v1.21.2 ═════════════╗
║ setup │ nodejs18, npm-8x ║
║─────────────────────────────────────────────║
║ install │ npm install --legacy-peer-deps ║
║─────────────────────────────────────────────║
║ build │ npm run build ║
║─────────────────────────────────────────────║
║ release │ npm run db:import ║
║─────────────────────────────────────────────║
║ start │ npm start ║
╚═════════════════════════════════════════════╝
0 building with "default" instance using docker driver
1 [internal] load build definition from Dockerfile
1 transferring dockerfile: 2.33kB done
1 DONE 0.0s
2 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1707782610
2 DONE 0.3s
3 [stage-0 1/10] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1707782610@sha256:8f4b0fd95dc3311cf9a59f236d8d7d7f956fe21a2a1d64b53c82f12c4e859f09
3 DONE 0.0s
4 [internal] load .dockerignore
4 transferring context: 2B done
4 DONE 0.0s
5 [internal] load build context
5 transferring context: 4.72MB 0.0s done
5 DONE 0.1s
6 [stage-0 2/10] WORKDIR /app/
6 CACHED
7 [stage-0 3/12] COPY .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix
7 CACHED
8 [stage-0 4/12] RUN nix-env -if .nixpacks/nixpkgs-bf744fe90419885eefced41b3e5ae442d732712d.nix && nix-collect-garbage -d
8 CACHED
9 [stage-0 5/12] COPY . /app/.
9 DONE 0.0s
10 [stage-0 6/12] RUN --mount=type=cache,id=s/5af59353-ef55-4c93-a4da-822c382cdcdc-/root/npm,target=/root/.npm npm install --legacy-peer-deps
10 0.603 npm
WARN config production Use --omit=dev
instead.
10 5.251 npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
10 …
6 [stage-0 2/10] WORKDIR /app/
6 CACHED
10 [stage-0 6/12] RUN --mount=type=cache,id=s/5af59353-ef55-4c93-a4da-822c382cdcdc-/root/npm,target=/root/.npm npm install --legacy-peer-deps
a year ago
It also looks like you are going to be running a development server on Railway, that is going to be costly and unstable.
Oh really hmm I am new to Railway and wanted to deploy my full stack web application for project deployment for my resume. What could I adjust do you have any fixes? I really appreciate the help!
a year ago
There is no error there, please attach your build logs using this -
https://bookmarklets.up.railway.app/log-downloader/
As for the if you are running a development server or how not to run a development server, I would need to see your GitHub Repository in order to give you an accurate answer.
a year ago
Ah sure ok! Attached the log - something about
"ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run db:import" did not complete successfully: exit code: 127
Error: Docker build failed"
Here is my Repository - https://github.com/matt-cha/plan-it
Attachments
a year ago
Try this nixpacks.toml file instead -
[phases.setup]
nixPkgs = ['...', 'postgresql']
[phases.install]
cmds = ['npm install --legacy-peer-deps']
Disclaimer: untested.
a year ago
Sending the new log I got after adding that code. Studying it myself right now as well thank you brody!
Attachments
a year ago
Perhaps you need to do a whitelist on azure? you would need to whitelist 0.0.0.0/0
Or, why not run your Postgres database on Railway?
a year ago
Right I'm thinking to move over completely from Azure as my free trial is running out soon. How would I run my PostgreSQL database on Railway instead now too?
a year ago
Click that + New
button in the top right of your project canvas, self explanatory from there!
Then you can update your DATABASE_URL
service variable to ${{Postgres.DATABASE_URL}}
Your trial on Railway will run out eventually too, I hope you won't jump ship when that time comes.
a year ago
Ah cool! Is that the only thing I need to change on the Variables tab of the Postgres page?
a year ago
I think Railway and Vercel is a lot easier to manage so hoping to stick with this one haha
a year ago
Please don't change anything in the databases variable tab, that variable is to be set on your apps service.
a year ago
Please don't put it in the .env.prod file either, that variable is to be set on Railway in your apps service.
a year ago
Forsure, just the .env file in my code then
a year ago
Nope, as previously mentioned, that variable is only to be set in the apps service in Railway.
a year ago
AH understood so sorry, the service variables of the app on Railway.
Thanks for being patient I appreciate it I haven't worked on this deployment in quite some time
a year ago
Do you mind explaining the costs to me of and what is the development server? I was thinking the only thing to host would be the backend for the data saved as an "event" but it'd be pretty small and wouldn't take much memory so it wouldn't be expensive to host on Railway
a year ago
I see yes 49MB !
a year ago
Then that doesn't seem like a development server, you should be good in that regard.
a year ago
Thank you! I'm getting this message now in the deployment logs of Postgres.
On my web app link it seems the database isn't running yet either and some errors in the console. Would possibly be able to help with this? I can create a new thread as I know it's a completely separate topic now
https://plan-it-matt-cha.vercel.app/
Attachments
a year ago
Ah forsure, what would be the next step in identifying what is causing this error on the web app? I'm trying to attach a screenshot if its showing of the console error
a year ago
As you can see there, your frontend is trying to make an API call to its own domain.
a year ago
I appreciate the help a lot brody, I'll have to sign off for today and get back on trying to fix this tomorrow! I can't understand why the GET request isn't working on this deployed page now
a year ago
It's not working because the frontend is making a GET request to the frontend's domain.
a year ago
I'm using React Router Dom to navigate and it was working previously like this on my Azure deployed site and Heroku before that, do I need to change this now? I appreciate the really novice questions brody!
Attachments
a year ago
Your frontend needs to make a request to the domain you have on your Railway service.
a year ago
By making the request to the domain of the Railway service is this what you mean brody? the GET request to https://plan-it.up.railway.app/api/events
Attachments
a year ago
Yes but if you are running your full stack app on Railway, why does vercel even come into play here?
a year ago
Ah I see you're right I had looked into Vercel and Railway from a friend telling me to deploy on Vercel and then using Railway for the backend but I would only need one then you're right!
But using that get request URL, it's still not working as intended as the /events URL doesn't work but creating a new event does (example: https://plan-it.up.railway.app/events/2
a year ago
I had this get route but I changed to the domain of the Railway service like you mentioned yesterday
Attachments
a year ago
Not quite what I mean, you need the same route in your server code to handle returning all the created events.
a year ago
Aplologies, that was the server code - the GET request
The client side fetches in the useEffect in this screenshot
Attachments
a year ago
Client side here:
Attachments
a year ago
Okay then there was some confusion here, last night I told you to have your frontend call the back's domain, but you seemed to change the path in your backend code as well, please change the path in the backend code back to just /api/events
a year ago
Got it! How can i also reset the data in my tables on Railway? I want to purge the created events I was making to test the data
a year ago
I would recommend deploying dbgate into your project and using that to delete data from the database.
+ New
-> Template
-> Search for dbGate
a year ago
Thanks so much brody, i'm looking into it now and will get back to you if I have questions! the page routing seems to be working now as well having the Railway domain for the client side URL's