我正在尝试使用React Frontend和Go Backend语言。
我必须在本地安装Go,并且可以运行诸如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时会失败?
我该如何解决?
谢谢