R
Railway•10mo ago
Constantine

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
Percy•10mo ago
Project ID: 138d844f-4f7b-4147-a4db-91e3c810b681
Fragly
Fragly•10mo ago
infamous 'glibc not found'
Constantine
ConstantineOP•10mo ago
138d844f-4f7b-4147-a4db-91e3c810b681 Any idea how to fix it?
Fragly
Fragly•10mo ago
Mind sending me your build logs using this tool? https://bookmarklets.up.railway.app/log-downloader/
Constantine
ConstantineOP•10mo ago
I'm on my phone rn, it doesn't seem to work
No description
Fragly
Fragly•10mo 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
Constantine
ConstantineOP•10mo ago
What is a build log Ok Is it my deployments
maddsua
maddsua•10mo 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
Brody•10mo ago
try adding a nixpacks.toml to your project with this in it
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
Constantine
ConstantineOP•10mo ago
Uhh I don't think so Alr thanks, I'll try it It seemed to give the same error
Constantine
ConstantineOP•10mo ago
No description
Brody
Brody•10mo ago
build logs please, fragly sent the bookmarklet you'd need to use to get them
Constantine
ConstantineOP•10mo 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
Brody•10mo 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
Constantine
ConstantineOP•10mo ago
Oh alr
Constantine
ConstantineOP•10mo ago
Brody
Brody•10mo ago
build logs please
Constantine
ConstantineOP•10mo ago
Oh my b
Brody
Brody•10mo ago
seems like you havent done this yet, please do
Constantine
ConstantineOP•10mo ago
I did,
No description
Brody
Brody•10mo ago
is the file in your repo?
Constantine
ConstantineOP•10mo ago
I pushed the changes , it gave the same error Yeah
Brody
Brody•10mo ago
latest build logs please
Constantine
ConstantineOP•10mo ago
These are latest
Brody
Brody•10mo ago
share your repo please
Constantine
ConstantineOP•10mo ago
GitHub
GitHub - IterationSeven/Mercury
Contribute to IterationSeven/Mercury development by creating an account on GitHub.
Brody
Brody•10mo ago
try this nixpacks.toml file instead
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
nixPkgs = ['...', 'libuuid', 'libGL']
[phases.setup]
nixLibs = ['...', 'libuuid', 'libGL']
nixPkgs = ['...', 'libuuid', 'libGL']
Constantine
ConstantineOP•10mo ago
Ok
Constantine
ConstantineOP•10mo ago
Same error I think
No description
Brody
Brody•10mo ago
build logs please
Constantine
ConstantineOP•10mo ago
Ok
Constantine
ConstantineOP•10mo 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
Brody•10mo ago
and we supposedly did that here too
Constantine
ConstantineOP•10mo ago
Is this a common issue
Brody
Brody•10mo ago
no, but try moving to a dockerfile based build
Constantine
ConstantineOP•10mo 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
Brody•10mo 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
Constantine
ConstantineOP•10mo ago
Ok, and I just run it like normal?
Brody
Brody•10mo ago
locally yes
Constantine
ConstantineOP•10mo ago
Ok, so it says there's a error in the build logs
No description
Constantine
ConstantineOP•10mo ago
But it works fine on replit
Brody
Brody•10mo ago
build logs please
Brody
Brody•10mo ago
i have updated this, please update your Dockerfile too
Constantine
ConstantineOP•10mo ago
I'm using node js btw not python
Brody
Brody•10mo ago
yeah but node-gyp needs python
Constantine
ConstantineOP•10mo ago
Oh alr
Brody
Brody•10mo ago
might also need other things, but we will start with that
Constantine
ConstantineOP•10mo ago
Yeah, same error
Brody
Brody•10mo ago
thats not the same error
Constantine
ConstantineOP•10mo ago
Oh It looked the same
Brody
Brody•10mo ago
it do look the same updated
Constantine
ConstantineOP•10mo ago
Ok, another error
Brody
Brody•10mo ago
what node version do you use locally?
Constantine
ConstantineOP•10mo ago
I'm not sure, let me check V20.10.0
Constantine
ConstantineOP•10mo ago
No description
Brody
Brody•10mo ago
haha why didnt you tell me you dont use node 18 locally updated
Constantine
ConstantineOP•10mo ago
Lol My b I didn't even know my version 😂
Constantine
ConstantineOP•10mo ago
error
Brody
Brody•10mo ago
nah it still needs python haha updated
Brody
Brody•10mo ago
run it back
Brody
Brody•10mo ago
okay that was a syntax error, my bad we will get there in the end lol
Constantine
ConstantineOP•10mo ago
It's all g dw Yes, it worked!!! Thanks so much 🙂 I've been stuck with that issue for like 2 months 😭
Brody
Brody•10mo ago
woohoo
Want results from more Discord servers?
Add your server