R
Railway4mo ago
7

Error when deploying discord bot

I've keep getting this error, I've been trying to fix this for months. Everything works fine on replit after I install and import the canvas node mod, but when I deploy to railway I get this error
No description
Solution:
try adding this as a Dockerfile to your project ```dockerfile FROM node:20.10.0-alpine ENV NODE_ENV production...
Jump to solution
69 Replies
Percy
Percy4mo ago
Project ID: 138d844f-4f7b-4147-a4db-91e3c810b681
Fragly
Fragly4mo ago
infamous 'glibc not found'
7
74mo ago
138d844f-4f7b-4147-a4db-91e3c810b681 Any idea how to fix it?
Fragly
Fragly4mo ago
Mind sending me your build logs using this tool? https://bookmarklets.up.railway.app/log-downloader/
7
74mo ago
I'm on my phone rn, it doesn't seem to work
No description
Fragly
Fragly4mo ago
yea unsure if it works on mobile no worries, just wanted to see your build logs to make sure nothing funny is going on, was a shot in the dark I have no idea Maybe someone who has an idea will hop in this thread though
7
74mo ago
What is a build log Ok Is it my deployments
maddsua
maddsua4mo ago
one more reason to migrate off nodejs alr, do u have any deps that may need binary files? like esbuild, squash or sharp?
Brody
Brody4mo ago
try adding a nixpacks.toml to your project with this in it
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
7
74mo ago
Uhh I don't think so Alr thanks, I'll try it It seemed to give the same error
7
74mo ago
No description
Brody
Brody4mo ago
build logs please, fragly sent the bookmarklet you'd need to use to get them
7
74mo ago
How do I use it on my phone? I'm on my phone rn, but I can't figure out how to get it to work And what's a bookmarklet
Brody
Brody4mo ago
you cant use it on a phone as far as i know, we have no problems waiting until youre able to get on a computer theres a link on the page to a site that explains it
7
74mo ago
Oh alr
7
74mo ago
Brody
Brody4mo ago
build logs please
7
74mo ago
Oh my b
Brody
Brody4mo ago
seems like you havent done this yet, please do
7
74mo ago
I did,
No description
Brody
Brody4mo ago
is the file in your repo?
7
74mo ago
I pushed the changes , it gave the same error Yeah
Brody
Brody4mo ago
latest build logs please
7
74mo ago
These are latest
Brody
Brody4mo ago
share your repo please
7
74mo ago
GitHub
GitHub - IterationSeven/Mercury
Contribute to IterationSeven/Mercury development by creating an account on GitHub.
Brody
Brody4mo ago
try this nixpacks.toml file instead
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
nixPkgs = ['...', 'libuuid', 'libGL']
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
nixPkgs = ['...', 'libuuid', 'libGL']
7
74mo ago
Ok
7
74mo ago
Same error I think
No description
Brody
Brody4mo ago
build logs please
7
74mo ago
Ok
7
74mo ago
Btw, In order to make canvas work on replit I had to add this
{pkgs}: {
deps = [
pkgs.nodePackages.prettier
pkgs.libuuid
];
env = { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid]; };
}
{pkgs}: {
deps = [
pkgs.nodePackages.prettier
pkgs.libuuid
];
env = { LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [pkgs.libuuid]; };
}
To my replit.nix file It fixed it on replit
Brody
Brody4mo ago
and we supposedly did that here too
7
74mo ago
Is this a common issue
Brody
Brody4mo ago
no, but try moving to a dockerfile based build
7
74mo ago
How do I do that? Is it just something I need to install on replit? I'm not very experienced with backend programming if you coudnt tell, I mostly just build websites so all of this is new to me
Solution
Brody
Brody4mo ago
try adding this as a Dockerfile to your project
FROM node:20.10.0-alpine

ENV NODE_ENV production
ENV NPM_CONFIG_UPDATE_NOTIFIER false
ENV NPM_CONFIG_FUND false

RUN apk add --update --no-cache \
libuuid \
python3 \
build-base \
pkgconf \
pixman \
cairo-dev \
pango-dev \
jpeg-dev \
giflib-dev

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . ./

CMD node src/index.js
FROM node:20.10.0-alpine

ENV NODE_ENV production
ENV NPM_CONFIG_UPDATE_NOTIFIER false
ENV NPM_CONFIG_FUND false

RUN apk add --update --no-cache \
libuuid \
python3 \
build-base \
pkgconf \
pixman \
cairo-dev \
pango-dev \
jpeg-dev \
giflib-dev

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . ./

CMD node src/index.js
7
74mo ago
Ok, and I just run it like normal?
Brody
Brody4mo ago
locally yes
7
74mo ago
Ok, so it says there's a error in the build logs
No description
7
74mo ago
But it works fine on replit
Brody
Brody4mo ago
build logs please
Brody
Brody4mo ago
i have updated this, please update your Dockerfile too
7
74mo ago
I'm using node js btw not python
Brody
Brody4mo ago
yeah but node-gyp needs python
7
74mo ago
Oh alr
Brody
Brody4mo ago
might also need other things, but we will start with that
7
74mo ago
Yeah, same error
Brody
Brody4mo ago
thats not the same error
7
74mo ago
Oh It looked the same
Brody
Brody4mo ago
it do look the same updated
7
74mo ago
Ok, another error
Brody
Brody4mo ago
what node version do you use locally?
7
74mo ago
I'm not sure, let me check V20.10.0
7
74mo ago
No description
Brody
Brody4mo ago
haha why didnt you tell me you dont use node 18 locally updated
7
74mo ago
Lol My b I didn't even know my version 😂
7
74mo ago
error
Brody
Brody4mo ago
nah it still needs python haha updated
Brody
Brody4mo ago
run it back
Brody
Brody4mo ago
okay that was a syntax error, my bad we will get there in the end lol
7
74mo ago
It's all g dw Yes, it worked!!! Thanks so much 🙂 I've been stuck with that issue for like 2 months 😭
Brody
Brody4mo ago
woohoo