I have hosted a Discord Bot on Fly, and it uses discord.js v13.10.3. It is specified in the package.json file. However when I build and deploy the project it installs discordjs v13.6.0!!!
I’m not sure why is this happening. It is working well and using correct version on my local PC.
My project uses a Dockerfile.
Please help me!!
Do you have a
package-lock.json file? Is it checked in as well? Is your
package.json file explicitly specifying the version?
It would help if you provided more information like your
package.json file and your
Dockerfile. The Dockerfile specifies which version of Node is being installed as well.
@Mark The source code is available at GitHub - onesoft-sudo/sudobot: A Discord Bot for moderation purposes.
You can see the Dockerfile and package.json file there.
The package.json file specifies that discord.js version “13.7.0” or higher is required.
I had a package-lock.json file but I’ve already deleted it and tested if that works, but it didn’t.
I’m new to docker, so if I do any mistake please tell me, it will be much appreciated.
I don’t have any experience with this library… but here are some observations and thoughts.
- This isn’t a Fly.io related problem.
- The package.json file specifies
^13.7.0. discord.js - npm - shows 13.7.0 is a deprecated release
- There may be other dependencies in package.json that cause it to fetch an older version. Try deleting your
node_modules folder locally and doing the same command to install it. It may replicate the problem.
- Consider an npm install command like this in Docker
RUN npm ci --progress=false --no-audit --loglevel=error. It likely won’t fix your problem at all, but it’s a more Docker friendly way to run it.
@Mark I fixed the problem finally, thanks for your help. But now I need another help.
I have a config directory where all bot config files are stored. The bot gets deployed in /app (according to Dockerfile), and I’ve created a volume at /data. I want to store the config directories to /data and symlink them to /app.
This is my Dockerfile right now:
COPY config .
COPY storage .
COPY package.json .
COPY package-lock.json .
COPY tsconfig.json .
COPY init.sh .
COPY src ./src
RUN npm ci --progress=false --no-audit --loglevel=error
RUN npm run build
COPY . .
RUN rm -rf config storage
RUN ln -s /data/config
RUN ln -s /data/storage
COPY . .
CMD ["npm", "run", "start:node"]
Now how do I store the config files to
/data? It does not actually store any data to /data and does not give any errors.
Glad you fixed the original issue.
If you are creating volumes and you want the data to persist, you need to create a persistent storage volume. It wasn’t clear if you did that or not.
I mean if there’s a way to transfer some static files like in this case some application config files to the storage volume, from my local PC?
And yes, I’ve created a persistent storage volume.