0

`Cannot find module 'internal/util/types' is the error I get, I am trying to build a discord.js bot and push it to heroku

error hint = A module may be missing from 'dependencies' in package.json

My require modules codes

require('dotenv').config();
const Discord = require('discord.js')

my package.json dependencies

"dependencies": {
    "discord.js": "^11.5.1",
    "dotenv": "8.2.0"
  },
Jytesh
  • 815
  • 4
  • 15
  • Try to remove `node_modules` and lock file. Then install all the packages again. – hsz Oct 17 '19 at 09:55
  • just tried that, still getting the same error. @hsz – Jytesh Oct 17 '19 at 10:13
  • can you build it locally? it might be that on heroku is an old node installed and you are using some dependencies that are using a newer version of node – micnic Oct 17 '19 at 12:47
  • Have you tried `npm rebuild`? If that does not work, clear your npm cache and reinstall node. See: https://stackoverflow.com/questions/50431593/after-node-reinstalled-cannot-find-module-internal-util-types https://stackoverflow.com/questions/52731038/error-cannot-find-module-internal-util-types-while-installing-node-packages https://stackoverflow.com/questions/50951689/cannot-find-module-internal-util-types-in-windows-10 – Jess Patton Oct 17 '19 at 12:48
  • I removed the engine part in package.json and now it works, no idea why. – Jytesh Oct 22 '19 at 16:58

1 Answers1

0

I removed the engines part in package.json and now it works. I am assuming its an issue with node versions.

Jytesh
  • 815
  • 4
  • 15