Skip to content
Advertisement

Heroku deployment of Node application returns node-waf: not found

I am attempting to deploy my Node.js application to Heroku by connecting Heroku to my Github repository and deploying the master branch.

I have tried a number of different approaches to deploy my application but all of them return the same error.

The exact build log can be found below:

-----> Node.js app detected

-----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_ENV=production
   NODE_MODULES_CACHE=true
   NODE_VERBOSE=false

-----> Installing binaries
       engines.node (package.json):  12.16.1
       engines.npm (package.json):   6.13.4
       engines.yarn (package.json):  1.19.1

   Resolving node version 12.16.1...
   Downloading and installing node 12.16.1...
   npm 6.13.4 already installed with node
   Resolving yarn version 1.19.1...
   Downloading and installing yarn (1.19.1)...
   Installed yarn 1.19.1

-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.19.1
       warning package.json: No license field
       warning No license field
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       [3/4] Linking dependencies...
       [4/4] Building fresh packages...
       error /tmp/build_6239d6c68cba3cabeb950e607f13b16d/node_modules/node-base64: Command failed.
       Exit code: 127
       Command: ./install.sh
       Arguments: 
       Directory: /tmp/build_6239d6c68cba3cabeb950e607f13b16d/node_modules/node-base64
       Output:
       ./install.sh: 3: ./install.sh: node-waf: not found
       info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
-----> Build failed

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

   If you're stuck, please submit a ticket so we can help:
   https://help.heroku.com/

   Love,
   Heroku

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

My package.json file can be found below:

{
  "engines": {
    "node": "12.16.1",
    "npm": "6.13.4",
    "yarn": "1.19.1"
  },
  "scripts": {
    "start": "tsc && node dist/app.js"
  },
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "express": "^4.17.1",
    "express-validator": "^6.4.0",
    "jsonwebtoken": "^8.5.1",
    "jwt": "^0.2.0",
    "mongoose": "^5.7.11",
    "passport": "^0.4.0",
    "passport-jwt": "^4.0.0",
    "passport-local": "^1.0.0",
    "typescript": "^3.8.3"
  },
  "devDependencies": {
    "@types/bcryptjs": "^2.4.2",
    "@types/cors": "^2.8.6",
    "@types/express": "^4.17.2",
    "@types/jsonwebtoken": "^8.3.5",
    "@types/mongoose": "^5.5.32",
    "@types/passport-jwt": "^3.0.3",
    "@types/passport-local": "^1.0.33",
    "prettier": "1.19.1",
    "tslint": "^5.20.1"
  }
}
  • I have tried adding the exact engine versions to the package.json.
  • I have tried removing yarn.lock.
  • I have tried installing typescript as a dependency instead as a global package.
  • I don’t know how I can manually install the node-base64/node-waf dependency.

Thank you for all your potential solutions.

Advertisement

Answer

TL;DR. Remove jwt and use jsonwebtoken.

Details: jwt has node-base64 as a dependency. Both jwt and node-base64 are no longer maintained. Under the hood, node-base64 uses node-waf which is already deprecated. So, this loop of calls to deprecated packages resulted to the failure you encountered. Replacing jwt with jsonwebtoken will solve this issue.

It’s also possible to encounter issues with node-waf without using jwt. See this Stackoverflow question Node-waf: not found to help you with that.

Advertisement