0

I am building a discord bot using discord.js v13 and for some reason i am getting heroku errors below given below and can't seem to figure out how to fix. I have already finished troubleshooting commong possible errors specified in the site from the error for heroku

npm ERR! code 7
npm ERR! path /tmp/build_0ada4b24/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c /tmp/install65944594579.sh
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.9
npm ERR! node-pre-gyp info using node@16.16.0 | linux | x64
npm ERR! node-pre-gyp ERR! UNCAUGHT EXCEPTION 
npm ERR! node-pre-gyp ERR! stack Error: Cannot find module '/tmp/build_0ada4b24/node_modules/whatwg-url/index.js'. Please verify that the package.json has a valid "main" entry
npm ERR! node-pre-gyp ERR! stack     at tryPackage (node:internal/modules/cjs/loader:353:19)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._findPath (node:internal/modules/cjs/loader:566:18)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
npm ERR! node-pre-gyp ERR! stack     at Function.Module._load (node:internal/modules/cjs/loader:778:27)
npm ERR! node-pre-gyp ERR! stack     at Module.require (node:internal/modules/cjs/loader:1005:19)
npm ERR! node-pre-gyp ERR! stack     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR! node-pre-gyp ERR! stack     at Object.<anonymous> (/tmp/build_0ada4b24/node_modules/node-fetch/lib/index.js:10:33)
npm ERR! node-pre-gyp ERR! stack     at Module._compile (node:internal/modules/cjs/loader:1105:14)
npm ERR! node-pre-gyp ERR! stack     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
npm ERR! node-pre-gyp ERR! stack     at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR! node-pre-gyp ERR! System Linux 4.4.0-1104-aws
npm ERR! node-pre-gyp ERR! command "/tmp/build_0ada4b24/.heroku/node/bin/node" "/tmp/build_0ada4b24/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /tmp/build_0ada4b24/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v16.16.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9

npm ERR! A complete log of this run can be found in:
npm ERR!     /tmp/npmcache.lmWki/_logs/2022-08-02T11_43_14_383Z-debug-0.log
-----> Build failed

We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys

Some possible problems:

- node_modules checked into source control
  https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits

- A module may be missing from 'dependencies' in package.json
  https://devcenter.heroku.com/articles/troubleshooting-node-deploys#ensure-you-aren-t-relying-on-untracked-dependencies

Love,
Heroku

!     Push rejected, failed to compile Node.js app.
!     Push failed

Package.json:

{
  "name": "harumaki",
  "version": "1.0.0",
  "main": "./Structures/index.js",
  "engines": {
    "node": "16.16.0",
    "npm": "8.13.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "Ninja",
  "license": "ISC",
  "dependencies": {
    "ascii-table": "^0.0.9",
    "canvas": "^2.9.3",
    "chalk": "^4.0.0",
    "chart.js": "^3.8.0",
    "chartjs-node-canvas": "^4.1.6",
    "chartjs-plugin-gradient": "^0.5.0",
    "discord-giveaways": "^5.2.2",
    "discord-html-transcripts": "^2.5.8",
    "discord.js": "^13.8.1",
    "glob": "^8.0.3",
    "kitsu.js": "^2.0.0",
    "moment": "^2.29.4",
    "moment-duration-format": "^2.3.2",
    "mongoose": "^6.4.4",
    "ms": "^2.1.3",
    "ms-prettify": "^1.3.3",
    "os-utils": "^0.0.14",
    "promise-timers": "^1.0.1",
    "quick.db": "^9.0.5",
    "rss-parser": "^3.12.0",
    "simple-youtube-api": "^5.2.1",
    "superagent": "^8.0.0",
    "tools": "^0.0.0"
  },
  "keywords": [],
  "description": ""
}
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
Aditya
  • 1
  • Questions here must be self-contained. In the future, include all relevant code _here_, as part of your question, instead of linking off-site. – ChrisGPT was on strike Aug 02 '22 at 14:06
  • Is your `node_modules/` directory tracked? As the error message from Heroku says, that is a common cause of this error. – ChrisGPT was on strike Aug 02 '22 at 14:10
  • i am getting a new error from heroku after fixing some things in the repo and now i highly doubt this isssue is comign from git. Yes node_modules/ is tracked @Chris New Error: -----> Creating runtime environment NPM_CONFIG_LOGLEVEL=error NODE_VERBOSE=false NODE_ENV=production NODE_MODULES_CACHE=true – Aditya Aug 03 '22 at 15:22
  • Okay, well `node_modules/` should _not_ be committed. I'll find a dupe. – ChrisGPT was on strike Aug 03 '22 at 15:23
  • "now i highly doubt this isssue is comign from git"—the issue _never_ came from Git. This is a build error that Git is simply passing back to you. – ChrisGPT was on strike Aug 03 '22 at 15:26

0 Answers0