First time deploying on Heroku and I’ve come across this hurdle that won’t let me successfully deploy my discord bot. I’ve been following a tutorial and the creator seemed to deploy his project on the platform no problem, however as with most things, it hasn’t been as straightforward the past hour.
The jist being the Error: cannot find module './discord.js'
I tried the solution from this answer, but no luck.
Here is my package.json:
"name": "booster-bot",
"version": "1.0.0",
"main": "index.js",
"engines": {
"node": "12.14.1",
"npm": "6.13.4"
},
"repository": {
"type": "git",
"url": "git+link"
},
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"start": "node bot.js",
"devStart": "nodemon bot.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"dotenv": "^16.4.5",
"requirements-txt": "^0.0.5"
},
"devDependencies": {
"nodemon": "^3.1.4"
}
}
As well as the block of code it points back to:
const {
Client,
Events,
GatewayIntentBits,
EmbedBuilder,
} = require("./discord.js");
const client = new Client({
partials: ["GUILD_MEMBER"],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildPresences,
],
});
To note is that I initially did not have the ./ in the ./discord.js, but as per this other answer and my desperation, I thought I’d try it (didn’t work). I also have the Procfile turned on and the requirements.txt installed, showing in this snippet on my package.json file:
"name": "booster-bot",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "booster-bot",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"dotenv": "^16.4.5",
"requirements-txt": "^0.0.5"
},
"devDependencies": {
"nodemon": "^3.1.4"
},
"engines": {
"node": "12.14.1",
"npm": "6.13.4"
}
},
Thank you for any input / help!