簡體   English   中英

Node.js應用程序上的H14代碼錯誤,在Heroku上具有Python依賴項

[英]H14 code error on Node.js app with Python dependencies on Heroku

在Heroku上部署Node.js應用程序時遇到了H14代碼錯誤。 該應用程序調用Python腳本,因此它具有某些程序包依賴性。

我遵循了文檔,換句話說,我的構建包如下:

  1. heroku/nodejs
  2. heroku/python

我在根目錄中有一個requirements.txt文件,以及一個包含python-3.6.3runtime.txt

package.json已配置,這里是其內容:

 {
  "name": "spam-community",
  "version": "1.0.0",
  "description": "This app is a spam and ham detector",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "server": "nodemon index.js"
  },
  "author": "Zadi younes",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.18.3",
    "child_process": "^1.0.2",
    "cookie-parser": "^1.4.4",
    "express": "^4.16.4",
    "mongoose": "^5.4.17",
    "multer": "^1.4.1",
    "nodemailer": "^5.1.1",
    "nodemon": "^1.18.10",
    "sendmail": "^1.4.1"
  },
  "engines": {
    "node": "10.x"
  }
}

我也嘗試使用命令heroku ps:scale web=1將網絡惡魔設置為一個,但出現錯誤

找不到該進程類型(網絡)

您的buildpack的順序很重要

列表中的最后一個buildpack將用於確定應用程序的進程類型 從早期buildpacks定義的任何進程類型都將被忽略。

您可以運行heroku help buildpacks以獲取命令的完整列表。

嘗試在heroku/python之后移動heroku/nodejs

heroku buildpacks:set heroku/nodejs
heroku buildpacks:add --index 1 heroku/python

使用heroku:buildpacks驗證您的heroku:buildpacks

如果您沒有Procfile這將尤其重要。 在這種情況下,假設heroku/nodejs是您的最后一個buildpack,則start腳本將自動運行

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM