3

我正在尝试使用 React Frontend 和 Go Backend 语言。

我必须在本地安装,我可以运行类似go run main.go或的命令go build。但是当我尝试推送到 Heroku 时,出现以下错误:

$ rm -rf index && go build -o index
remote: /bin/sh: 1: go: not found
remote: error Command failed with exit code 127.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote: error Command failed with exit code 127.
remote:        info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote: -----> Build failed

这是我的 package.json:

{
  "name": "fullstack-course",
  "version": "1.0.0",
  "description": "",
  "main": "index.go",
  "scripts": {
    "client": "rm -rf build/ && webpack --env.mode production",
    "server": "rm -rf index && go build -o index",
    "start": "./index",
    "heroku-postbuild": "yarn run client && yarn run server"
  },
  "engines": {
    "node": "10.x",
    "npm": "6.9.x",
    "yarn": "1.x"
  },
  "repository": {
    "type": "git",
  },
  "author": "",
  "license": "ISC",
  "dependencies": {...}
}

为什么在本地运行时它可以工作,但在将其推送到 Heroku 时却失败了?

我怎样才能解决这个问题?

谢谢

4

0 回答 0