I'm trying to use React Frontend and Go Backend language.
I have to Go installed locally and I can run commands like go run main.go
or go build
. But when I try to push to Heroku, I get the following error:
$ 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
This is my 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": {...}
}
Why when running locally it works, but when pushing it to Heroku it fails?
How can I fix this?
Thanks