Discord bot regularly fails to find discord.js



My Discord bot is occasionally throwing the error Cannot find module discord.js. The error is fixed every time I reinstall discord.js using the console.

This is my package.json file:

  "name": "<redacted>",
  "version": "1.0.0",
  "description": "<redacted>",
  "main": "main.js",
  "dependencies": {
"discord.js": "^11.4.2",
"enmap": "^4.1.3",
"express": "^4.16.3",
"express.js": "^4.16.3",
"winston": "^2.4.1"
  "scripts": {
"start": "node main.js",
"test": "node tests.js"
  "repository": {
"type": "git",
"url": "<redacted>"
  "author": "<redacted>",
  "license": "MIT",
  "bugs": {
"url": "<redacted>"
  "homepage": "<redacted>"


You shouldn’t need to install discord.js via the console - including it in the package.json is enough. Make sure your watch.json file isn’t preventing changes to package.json from being applied. Also try running df at the console and seeing the percentage disk space used for the /app folder as it could be your project has run out of space, producing the error you see.


Thank you, remixing the project worked to fix the error loop. I suspect that it was related to installing discord.js from the console.