繁体   English   中英

Heroku 部署 Node 应用程序返回 node-waf: not found

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

我正在尝试通过将 Heroku 连接到我的 ZE1ADBCBB92C622D70B3E619F9 存储库并将我的 Node.js 应用程序部署到 Heroku

我尝试了多种不同的方法来部署我的应用程序,但它们都返回相同的错误。

可以在下面找到确切的构建日志:

-----> 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

我的package.json文件可以在下面找到:

{
  "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"
  }
}
  • 我尝试将确切的引擎版本添加到 package.json。
  • 我试过删除yarn.lock。
  • 我尝试将 typescript 作为依赖项安装,而不是作为全局 package 安装。
  • 我不知道如何手动安装 node-base64/node-waf 依赖项。

感谢您提供所有潜在的解决方案。

TL;博士。 删除jwt并使用jsonwebtoken

详细信息: jwt具有node-base64作为依赖项。 jwt 和 node-base64 都不再维护。 在幕后,node-base64 使用已弃用node-waf 因此,这个对已弃用包的调用循环导致了您遇到的失败。 jwt替换jsonwebtoken将解决这个问题。

在不使用 jwt 的情况下,也可能会遇到node-waf的问题。 请参阅此 Stackoverflow 问题Node-waf: not found来帮助您。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM