Gatsby build on netlify used to work perfectly, but suddenly stopped working. It builds locally, but returns error bash: gatsby: command not found
on netlify.
What I’ve already tried:
- change the build command to “npm run build”, “npm build”, “yarn run build” and “yarn build” (despite of the “gatsby build” itself)
- set the node/yarn/npm versions as environment variables;
- deploy with package-lock AND yarn-lock (not at the same time);
- change the node version;
- I also checked the topics commented in this topic: Build script returned non-zero exit code: 127.
Nothing worked
Link to the repository: https://github.com/ramosht/ramosht.com
Log:
12:05:31 PM: Build ready to start
12:05:36 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
12:05:36 PM: build-image tag: v3.4.1
12:05:36 PM: buildbot version: 9042ba4998dab698f1f37fb8d36912c08a387191
12:05:36 PM: Building without cache
12:05:36 PM: Starting to prepare the repo for build
12:05:36 PM: No cached dependencies found. Cloning fresh repo
12:05:36 PM: git clone https://github.com/ramosht/ramosht
12:05:37 PM: Preparing Git Reference refs/heads/master
12:05:38 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
12:05:38 PM: Starting build script
12:05:38 PM: Installing dependencies
12:05:38 PM: Python version set to 2.7
12:05:40 PM: v12.18.0 is already installed.
12:05:40 PM: Now using node v12.18.0 (npm v6.14.4)
12:05:40 PM: Started restoring cached build plugins
12:05:40 PM: Finished restoring cached build plugins
12:05:41 PM: Attempting ruby version 2.6.2, read from environment
12:05:42 PM: Using ruby version 2.6.2
12:05:43 PM: Using PHP version 5.6
12:05:43 PM: 5.2 is already installed.
12:05:43 PM: Using Swift version 5.2
12:05:43 PM: Started restoring cached go cache
12:05:43 PM: Finished restoring cached go cache
12:05:43 PM: Installing Go version 1.12
12:05:50 PM: unset GOOS;
12:05:50 PM: unset GOARCH;
12:05:50 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
12:05:50 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
12:05:50 PM: go version >&2;
12:05:50 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
12:05:50 PM: go version go1.12 linux/amd64
12:05:50 PM: Installing missing commands
12:05:50 PM: Verify run directory
12:05:51 PM:
12:05:51 PM: ┌─────────────────────────────┐
12:05:51 PM: │ Netlify Build │
12:05:51 PM: └─────────────────────────────┘
12:05:51 PM:
12:05:51 PM: ❯ Version
12:05:51 PM: @netlify/build 3.1.10
12:05:51 PM:
12:05:51 PM: ❯ Flags
12:05:51 PM: deployId: 5f394b3bfb8f7849a7f53b20
12:05:51 PM: mode: buildbot
12:05:51 PM: timersFile: /tmp/substage_times.txt
12:05:51 PM:
12:05:51 PM: ❯ Current directory
12:05:51 PM: /opt/build/repo
12:05:51 PM:
12:05:51 PM: ❯ Config file
12:05:51 PM: No config file was defined: using default values.
12:05:51 PM:
12:05:51 PM: ❯ Context
12:05:51 PM: production
12:05:51 PM:
12:05:51 PM: ┌───────────────────────────────────┐
12:05:51 PM: │ 1. Build command from Netlify app │
12:05:51 PM: └───────────────────────────────────┘
12:05:51 PM:
12:05:51 PM: $ yarn build
12:05:51 PM: bash: yarn: command not found
12:05:51 PM:
12:05:51 PM: ┌─────────────────────────────┐
12:05:51 PM: │ "build.command" failed │
12:05:51 PM: └─────────────────────────────┘
12:05:51 PM:
12:05:51 PM: Error message
12:05:51 PM: Command failed with exit code 127: yarn build
12:05:51 PM:
12:05:51 PM: Error location
12:05:51 PM: In Build command from Netlify app:
12:05:51 PM: yarn build
12:05:51 PM:
12:05:51 PM: Resolved config
12:05:51 PM: build:
12:05:51 PM: command: yarn build
12:05:51 PM: commandOrigin: ui
12:05:51 PM: environment:
12:05:51 PM: - GOOGLE_ANALYTICS_TRACKING_ID
12:05:51 PM: - NODE_VERSION
12:05:51 PM: publish: /opt/build/repo/public
12:05:51 PM: Caching artifacts
12:05:51 PM: Started saving build plugins
12:05:51 PM: Finished saving build plugins
12:05:51 PM: Started saving pip cache
12:05:51 PM: Finished saving pip cache
12:05:51 PM: Started saving emacs cask dependencies
12:05:51 PM: Finished saving emacs cask dependencies
12:05:51 PM: Started saving maven dependencies
12:05:51 PM: Finished saving maven dependencies
12:05:51 PM: Started saving boot dependencies
12:05:51 PM: Finished saving boot dependencies
12:05:52 PM: Started saving go dependencies
12:05:53 PM: Finished saving go dependencies
12:05:56 PM: Error running command: Build script returned non-zero exit code: 1
12:05:56 PM: Failing build: Failed to build site
12:05:56 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
12:05:56 PM: Finished processing build request in 20.494946057s
package.json
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
"dependencies": {
"@weknow/gatsby-remark-codepen": "^0.1.0",
"babel-preset-gatsby": "^0.5.1",
"date-fns": "^2.14.0",
"gatsby": "^2.19.43",
"gatsby-cli": "^2.1.60",
"gatsby-image": "^2.2.43",
"gatsby-plugin-canonical-urls": "^2.3.0",
"gatsby-plugin-google-analytics": "^2.3.0",
"gatsby-plugin-manifest": "^2.2.47",
"gatsby-plugin-netlify-cms": "^4.3.0",
"gatsby-plugin-offline": "3.0.40",
"gatsby-plugin-react-helmet": "^3.1.23",
"gatsby-plugin-sharp": "^2.4.12",
"gatsby-plugin-sitemap": "^2.4.1",
"gatsby-plugin-styled-components": "^3.1.21",
"gatsby-remark-images": "^3.3.0",
"gatsby-remark-lazy-load": "^1.0.2",
"gatsby-remark-prismjs": "3.3.5",
"gatsby-remark-relative-images": "^0.3.0",
"gatsby-remark-relative-images-v2": "^0.1.5",
"gatsby-source-filesystem": "^2.1.55",
"gatsby-transformer-json": "^2.4.10",
"gatsby-transformer-remark": "^2.8.23",
"gatsby-transformer-sharp": "^2.3.18",
"lazysizes": "^5.2.0",
"netlify-cms-app": "^2.12.11",
"prismjs": "1.17.1",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-animated-burgers": "^1.2.7",
"react-disqus-comments": "^1.4.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1",
"react-responsive": "^8.1.0",
"save": "^2.4.0",
"styled-components": "^4.3.2",
"styled-icons": "^10.2.1",
"uuidv4": "^6.1.1"
},
"devDependencies": {
"prettier": "^1.19.1"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}