Error: Cannot find module 'discord.js'


Hi there,

i am a new coder that trying to code a discord bot with discord js and run into some tutorials in 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”: “!/intothefantasy
“license”: “MIT”,
“keywords”: [


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:


Hi there

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


Hello Can you tell me how you fixed
Step by step
I am still getting this error. :frowning:


In the above scenario, you go into the package.json file and change the value alongside ‘version’ to 1.0.0. However, there are a few potential causes of this problem, so if that doesn’t fix it then provide your project name and we can take a look for you.


Hi, I’m having a similar issue.
Error: Cannot find module ‘discord.js’

at Function.Module._resolveFilename (module.js:489:15)

at Function.Module._load (module.js:439:25)

at Module.require (module.js:517:17)

at require (internal/module.js:11:18)

at Object. (/app/server.js:1:79)

at Module._compile (module.js:573:30)

at Object.Module._extensions..js (module.js:584:10)

at Module.load (module.js:507:32)

at tryModuleLoad (module.js:470:12)

at Function.Module._load (module.js:462:3)

:beetle: The debugger could not be started. See

My package json:


“name”: “l o s t s o u l”,
“version”: “2.0.2”,
“description”: “noot noot”,
“main”: “node server.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”,
“start”: “node server.js”
“engines”: {
“node”: “8.4.0”
“author”: “Big Sis!”,
“license”: “don’t steal or i kill u”,
“dependencies”: {
“discord.js”: “^11.4.2”,
“dotenv”: “^6.0.0”,
“enmap”: “^4.2.4”,
“express”: “^4.16.3”,
“moment”: “^2.22.2”,
“moment-duration-format”: “^2.2.2”

Trying to change it to 1.0.0 did nothing for me.


project name: outgoing-actress


The name value you’ve specified in package.json can’t contain spaces, try changing it to ‘lostsoul’

Glitch project suddenly offline even though we use Uptime Robot, and can't seem to be fixeD?

i didn’t do that, but:
all i did was run these under console:

npm install discord.js
npm install dotenv
npm install express

and it worked for me. hope this helps anyone else having this issue. :slight_smile: