Search code examples
node.jsherokuheroku-nodejs

Heroku Stuck on Installing node modules


as the title states i have created a nodejs project, this is my first "clean deploy" where i just import from github and then add the env and buildpack for nodejs then deploy from the latest build,

Heres the log:

-----> Building on the Heroku-24 stack
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_VERBOSE=false
       NODE_ENV=development
       NODE_MODULES_CACHE=true
       
-----> Installing binaries
       engines.node (package.json):   20.15.0
       engines.npm (package.json):    10.9.0
       
       Resolving node version 20.15.0...
       Downloading and installing node 20.15.0...
       Bootstrapping npm 10.9.0 (replacing 10.7.0)...
       npm 10.9.0 installed
       
-----> Installing dependencies
       Installing node modules

heres my package.json

{
  "name": "xyz-crm-business-ai",
  "version": "1.0.0",
  "description": "Business AI Training Backend",
  "main": "server.js",
  "scripts": {
    "start": "node server.js",
    "build": "echo 'No build required'",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install"
  },
  "dependencies": {
    "@supabase/supabase-js": "^2.39.0",
    "cors": "^2.8.5",
    "dotenv": "^16.3.1",
    "express": "^4.18.2",
    "morgan": "^1.10.0",
    "multer": "1.4.5-lts.1",
    "openai": "^4.20.1",
    "puppeteer": "^21.5.2"
  },
  "devDependencies": {
    "nodemon": "^3.0.1"
  }
}

and finally heres my env

SUPABASE_URL=*************
SUPABASE_KEY=*************
CLERK_SECRET_KEY=*************
DEV_FRONTEND_URL=http://localhost:5173
FRONTEND_URL=*************


# Server Configuration
PORT=3000
NODE_ENV=development
# File Upload Configuration
MAX_FILE_SIZE=10485760 # 10MB in bytes
MAX_FILES=10

# Chrome configuration
CHROME_PATH=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome  # For Mac
# CHROME_PATH=C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe  # For Windows
# CHROME_PATH=/usr/bin/google-chrome  # For Linux
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true  # Optional: Use system Chrome
CHROME_BIN=/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

i have tried deleting all the node modules, and package lock, and re-pushing, and then another build ends up happening waiting for the previous to finish, i have deleted app and tried again as well

Thanks in advance


Solution

  • The issue ended up being with puppeeter, heroku has an issue with it, to fix it we have to add a flag to the build.

    When Puppeteer is installed, it triggers a download of a large file such as Chrome. Depending on the network, this can cause a build to timeout. We've found that users no longer see timeouts after adding a PUPPETEER_SKIP_DOWNLOAD config var and setting it to true. This skips the Chrome download and has improved build time.