Error: Cannot find module 'discord.js'


#1

Hi there,

i am a new coder that trying to code a discord bot with discord js and run into some tutorials in Glitch.com hosting as well. But i seem to hit this error where discord.js is not found from my simple bot file

here is my package.json
{
“name”: “rembot”,
“version”: “1.0”,
“description”: “Test bot”,
“main”: “node rem.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”,
“start”: “node rem.js”
},
“dependencies”: {
“express”: “^4.16.3”,
“discord.js”: “^11.3.2”,
“enmap”: “^2.1.0”,
“moment”: “^2.22.0”,
“moment-duration-format”: “^2.2.2”
},
“engines”: {
“node”: “8.4.0”
},
“repository”: {
“url”: “https://glitch.com/edit/#!/intothefantasy
},
“license”: “MIT”,
“keywords”: [
“node”,
“glitch”,
“express”
]
}


#2

Hi @intothefantasy,

your package.json has an error (well, in Glitch it is counted as an error): your version field does not contain a valid semver. This is why the packages don’t get installed. You should set it to 1.0.0 (for example), and then the packages will be installed. If you scroll up in the Logs, you’ll see that this error is reported.

Let us know if this fixes your issue :slight_smile:


#3

Hi there

thanks for the response, it fixes my issue after removing the version