簡體   English   中英

無法將后端為 Nodejs、前端為 ReactJs 的全棧項目部署到 Heroku

[英]Failed to deploy a full-stack project with Nodejs in backend and ReactJs in frontend to Heroku

我有一個全棧項目的工作目錄如下所示:

|__ 服務器
|
|__ 客戶
|
|__ 節點模塊
|
|__ 包.json

  • 在文件夾服務器中是一個用於后端的 NodeJs
  • 在文件夾客戶端是前端的 ReacJs
  • 這是根文件夾中 package.json 中的代碼:
{
  "name": "kmail",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "client": "cd client && npm start",
    "server": "cd server && npm start",
    "start": "concurrently - kill-others \"npm run server\" \"npm run client\""
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "concurrently": "3.5.1"
  }
}

當我在本地運行項目時,它工作正常。 但是,當我將它部署到 Heroku 時,它失敗了,這是我得到的日志:

Starting process with command 'npm start'
concurrently - kill-others "npm run server" "npm run client"
concurrently - kill-others: not found

你知道解決這個問題的任何解決方案嗎? 或者除了 Heroku 之外還有什么主機服務可以幫助解決我的問題? 非常感謝。

好吧,“啟動”腳本應該啟動服務器部分

"start": "node index.js --prefix server"

Heroku 查找“啟動”腳本並實際使用它來運行應用程序。

嘗試更改它,如果錯誤仍然存​​在,請在此處粘貼整個日志

我認為是--kill-others不是- kill-others

"start": "concurrently --kill-others \"npm run server\" \"npm run client\""

暫無
暫無

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

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