Home
Support Forums

Can't deploy my site, not sure why

Not sure why it won’t build.

I did the settings for gatsby a susggested in your docs. But, still nothing. Before it deployed but then it said page not found. So, I deleted it and tried again.

6:01:27 PM: Build ready to start
6:01:29 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
6:01:29 PM: build-image tag: v4.3.0
6:01:29 PM: buildbot version: c61b3177f7abcf70dda1a1a58b31afc6719cd2c7
6:01:29 PM: Fetching cached dependencies
6:01:29 PM: Failed to fetch cache, continuing with build
6:01:29 PM: Starting to prepare the repo for build
6:01:30 PM: No cached dependencies found. Cloning fresh repo
6:01:30 PM: git clone https://github.com/shar27/simple-folio
6:01:30 PM: Preparing Git Reference refs/heads/main
6:01:31 PM: Parsing package.json dependencies
6:01:31 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: β€˜public’ versus β€˜public/’ in the Netlify UI
6:01:32 PM: Starting build script
6:01:32 PM: Installing dependencies
6:01:32 PM: Python version set to 2.7
6:01:32 PM: Downloading and installing node v16.9.1…
6:01:33 PM: Downloading https://nodejs.org/dist/v16.9.1/node-v16.9.1-linux-x64.tar.xz…
6:01:33 PM: Computing checksum with sha256sum
6:01:33 PM: Checksums matched!
6:01:37 PM: Now using node v16.9.1 (npm v7.21.1)
6:01:37 PM: Started restoring cached build plugins
6:01:37 PM: Finished restoring cached build plugins
6:01:37 PM: Attempting ruby version 2.7.2, read from environment
6:01:39 PM: Using ruby version 2.7.2
6:01:39 PM: Using PHP version 8.0
6:01:39 PM: Started restoring cached go cache
6:01:39 PM: Finished restoring cached go cache
6:01:39 PM: go version go1.16.5 linux/amd64
6:01:39 PM: go version go1.16.5 linux/amd64
6:01:39 PM: Installing missing commands
6:01:39 PM: Verify run directory
6:01:41 PM: ​
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: Netlify Build
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: ​
6:01:41 PM: ❯ Version
6:01:41 PM: @netlify/build 18.8.0
6:01:41 PM: ​
6:01:41 PM: ❯ Flags
6:01:41 PM: baseRelDir: true
6:01:41 PM: buildId: 613f75d7fe74620ae1eb907c
6:01:41 PM: deployId: 613f75d7fe74620ae1eb907e
6:01:41 PM: ​
6:01:41 PM: ❯ Current directory
6:01:41 PM: /opt/build/repo
6:01:41 PM: ​
6:01:41 PM: ❯ Config file
6:01:41 PM: No config file was defined: using default values.
6:01:41 PM: ​
6:01:41 PM: ❯ Context
6:01:41 PM: production
6:01:41 PM: ​
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: 1. Build command from Netlify app
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: ​
6:01:41 PM: $ gatsby build
6:01:41 PM: bash: gatsby: command not found
6:01:41 PM: ​
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: β€œbuild.command” failed
6:01:41 PM: ────────────────────────────────────────────────────────────────
6:01:41 PM: ​
6:01:41 PM: Error message
6:01:41 PM: Command failed with exit code 127: gatsby build
6:01:41 PM: ​
6:01:41 PM: Error location
6:01:41 PM: In Build command from Netlify app:
6:01:41 PM: gatsby build
6:01:41 PM: ​
6:01:41 PM: Resolved config
6:01:41 PM: build:
6:01:41 PM: command: gatsby build
6:01:41 PM: commandOrigin: ui
6:01:41 PM: publish: /opt/build/repo/public
6:01:41 PM: publishOrigin: ui
6:01:42 PM: Caching artifacts
6:01:42 PM: Started saving build plugins
6:01:42 PM: Finished saving build plugins
6:01:42 PM: Started saving pip cache
6:01:42 PM: Finished saving pip cache
6:01:42 PM: Started saving emacs cask dependencies
6:01:42 PM: Finished saving emacs cask dependencies
6:01:42 PM: Started saving maven dependencies
6:01:42 PM: Finished saving maven dependencies
6:01:42 PM: Started saving boot dependencies
6:01:42 PM: Finished saving boot dependencies
6:01:42 PM: Started saving rust rustup cache
6:01:42 PM: Finished saving rust rustup cache
6:01:42 PM: Started saving go dependencies
6:01:42 PM: Finished saving go dependencies
6:01:45 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:01:45 PM: Creating deploy upload records
6:01:45 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
6:01:45 PM: Failing build: Failed to build site
6:01:45 PM: Finished processing build request in 15.677339295s

The better the post - the faster the answer.

Hiya, sorry you are having trouble with your build.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

Thanks for the reply.

Here is the Json

{

β€œname”: β€œgatsby-starter-hello-world”,

β€œprivate”: true,

β€œdescription”: β€œA simplified bare-bones starter for Gatsby”,

β€œversion”: β€œ0.1.0”,

β€œ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"

},

β€œdependencies”: {

"bootstrap": "^4.5.0",

"gatsby": "^2.23.7",

"gatsby-image": "^2.4.7",

"gatsby-plugin-manifest": "^2.4.12",

"gatsby-plugin-offline": "^3.2.11",

"gatsby-plugin-react-helmet": "^3.3.4",

"gatsby-plugin-sass": "^2.3.4",

"gatsby-plugin-sharp": "^2.6.12",

"gatsby-source-filesystem": "^2.3.12",

"gatsby-transformer-sharp": "^2.5.5",

"nanoid": "^3.1.10",

"node-sass": "^4.14.1",

"prop-types": "^15.7.2",

"react": "^16.13.1",

"react-bootstrap": "^1.0.1",

"react-dom": "^16.13.1",

"react-github-btn": "^1.2.0",

"react-helmet": "^6.1.0",

"react-reveal": "^1.2.2",

"react-scroll": "^1.7.16",

"react-tilt": "^0.1.4"

},

β€œdevDependencies”: {

"babel-eslint": "^10.1.0",

"eslint": "7.2.0",

"eslint-config-airbnb": "^18.2.0",

"eslint-config-prettier": "^6.11.0",

"eslint-plugin-import": "^2.21.2",

"eslint-plugin-jsx-a11y": "^6.3.1",

"eslint-plugin-prettier": "^3.1.4",

"eslint-plugin-react": "^7.20.0",

"eslint-plugin-react-hooks": "^4.0.4",

"husky": "^4.2.5",

"lint-staged": "^10.2.11",

"prettier": "^2.0.5"

},

β€œrepository”: {

"type": "git",

"url": "https://github.com/gatsbyjs/gatsby-starter-hello-world"

},

β€œbugs”: {

"url": "https://github.com/gatsbyjs/gatsby/issues"

},

β€œhusky”: {

"hooks": {

  "pre-commit": "lint-staged"

}

},

β€œlint-staged”: {

"*.+(js|jsx)": [

  "eslint --fix",

  "git add"

],

"*.+(json|css|md)": [

  "prettier --write",

  "git add"

]

}

}

I have tried npm run build. I have tried searching through the forums but still nothing.

hi there, please try moving gatsby from dependencies to devdependencies in your package json, upload, deploy, and see of that works better.

the build command is erroring because gatsby isn’t available at build time, because it is listed as a run time dependency, even though it is necessary for the build process.

all of these ?

β€œgatsby”: β€œ^2.23.7”,

"gatsby-image": "^2.4.7",

"gatsby-plugin-manifest": "^2.4.12",

"gatsby-plugin-offline": "^3.2.11",

"gatsby-plugin-react-helmet": "^3.3.4",

"gatsby-plugin-sass": "^2.3.4",

"gatsby-plugin-sharp": "^2.6.12",

"gatsby-source-filesystem": "^2.3.12",

"gatsby-transformer-sharp": "^2.5.5",

Hey no luck - moved them all to the devdep.

7:58:39 PM: Build ready to start
7:58:40 PM: build-image version: fa439ad1ab9393b2c0d449d8d7c033927683f4b0
7:58:40 PM: build-image tag: v4.3.0
7:58:40 PM: buildbot version: c61b3177f7abcf70dda1a1a58b31afc6719cd2c7
7:58:41 PM: Fetching cached dependencies
7:58:41 PM: Failed to fetch cache, continuing with build
7:58:41 PM: Starting to prepare the repo for build
7:58:41 PM: No cached dependencies found. Cloning fresh repo
7:58:41 PM: git clone https://github.com/shar27/simple-folio
7:58:42 PM: Preparing Git Reference refs/heads/main
7:58:42 PM: Parsing package.json dependencies
7:58:43 PM: Starting build script
7:58:43 PM: Installing dependencies
7:58:43 PM: Python version set to 2.7
7:58:44 PM: Downloading and installing node v16.9.1…
7:58:44 PM: Downloading https://nodejs.org/dist/v16.9.1/node-v16.9.1-linux-x64.tar.xz…
7:58:44 PM: Computing checksum with sha256sum
7:58:44 PM: Checksums matched!
7:58:48 PM: Now using node v16.9.1 (npm v7.21.1)
7:58:48 PM: Started restoring cached build plugins
7:58:48 PM: Finished restoring cached build plugins
7:58:48 PM: Attempting ruby version 2.7.2, read from environment
7:58:49 PM: Using ruby version 2.7.2
7:58:50 PM: Using PHP version 8.0
7:58:50 PM: Started restoring cached go cache
7:58:50 PM: Finished restoring cached go cache
7:58:50 PM: go version go1.16.5 linux/amd64
7:58:50 PM: go version go1.16.5 linux/amd64
7:58:50 PM: Installing missing commands
7:58:50 PM: Verify run directory
7:58:51 PM: ​
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: Netlify Build
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: ​
7:58:51 PM: ❯ Version
7:58:51 PM: @netlify/build 18.8.0
7:58:51 PM: ​
7:58:51 PM: ❯ Flags
7:58:51 PM: baseRelDir: true
7:58:51 PM: buildId: 613f914f07789b197b832b59
7:58:51 PM: deployId: 613f914f07789b197b832b5b
7:58:51 PM: ​
7:58:51 PM: ❯ Current directory
7:58:51 PM: /opt/build/repo
7:58:51 PM: ​
7:58:51 PM: ❯ Config file
7:58:51 PM: No config file was defined: using default values.
7:58:51 PM: ​
7:58:51 PM: ❯ Context
7:58:51 PM: production
7:58:51 PM: ​
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: 1. Build command from Netlify app
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: ​
7:58:51 PM: $ gatsby build
7:58:51 PM: bash: gatsby: command not found
7:58:51 PM: ​
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: β€œbuild.command” failed
7:58:51 PM: ────────────────────────────────────────────────────────────────
7:58:51 PM: ​
7:58:51 PM: Error message
7:58:51 PM: Command failed with exit code 127: gatsby build
7:58:51 PM: ​
7:58:51 PM: Error location
7:58:51 PM: In Build command from Netlify app:
7:58:51 PM: gatsby build
7:58:51 PM: ​
7:58:51 PM: Resolved config
7:58:51 PM: build:
7:58:51 PM: command: gatsby build
7:58:51 PM: commandOrigin: ui
7:58:51 PM: publish: /opt/build/repo/public
7:58:51 PM: publishOrigin: ui
7:58:52 PM: Caching artifacts
7:58:52 PM: Started saving build plugins
7:58:52 PM: Finished saving build plugins
7:58:52 PM: Started saving pip cache
7:58:52 PM: Finished saving pip cache
7:58:52 PM: Started saving emacs cask dependencies
7:58:52 PM: Finished saving emacs cask dependencies
7:58:52 PM: Started saving maven dependencies
7:58:52 PM: Finished saving maven dependencies
7:58:52 PM: Started saving boot dependencies
7:58:52 PM: Finished saving boot dependencies
7:58:52 PM: Started saving rust rustup cache
7:58:52 PM: Finished saving rust rustup cache
7:58:52 PM: Started saving go dependencies
7:58:52 PM: Finished saving go dependencies
7:58:55 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:58:55 PM: Creating deploy upload records
7:58:55 PM: Failing build: Failed to build site
7:58:55 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
7:58:55 PM: Finished processing build request in 14.259895352s

Hey Perry,

Any idea?

hi there, is this working locally? this is definitely a gatsby configuration issue as opposed to a netlify issue, so you’d want to verify that you have it working locally first before debugging a deployed build. is that the case?

Are you building in the gatsby-simplefolio directory inside your git repository or are you building in the root @shar27?

it is working locally

git repo, I followed the instructions from the netlify website.

Perhaps try setting the base directory to gatsby-simplefolio in the Netlify UI then try building.

still didn’t build, the different this was time. It tried and it went on for some time. This is the error log.

Perry suggested changed the location of gatsby in JSON. So, I tried to build it like with your suggestion of gatsby-simplefolio. It failed. I then did the reverse and placed the gatsby config in to depend rather devde.
Still failed.

https://app.netlify.com/sites/flamboyant-dubinsky-5d0915/deploys

10:34:30 AM: npm ERR! In file included from …/…/nan/nan.h:58,
10:34:30 AM: npm ERR! from …/src/binding.cpp:1:
10:34:30 AM: npm ERR! …/src/binding.cpp: At global scope:
10:34:30 AM: npm ERR! /opt/buildhome/.node-gyp/16.9.1/include/node/node.h:810:43: warning: cast between incompatible function types from β€˜void ()(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka β€˜void ()(v8::Localv8::Object)’} to β€˜node::addon_register_func’ {aka β€˜void ()(v8::Localv8::Object, v8::Localv8::Value, void)’} [-Wcast-function-type]
10:34:30 AM: npm ERR! 810 | (node::addon_register_func) (regfunc),
10:34:30 AM: npm ERR! | ^
10:34:30 AM: npm ERR! /opt/buildhome/.node-gyp/16.9.1/include/node/node.h:844:3: note: in expansion of macro β€˜NODE_MODULE_X’
10:34:30 AM: npm ERR! 844 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
10:34:30 AM: npm ERR! | ^~~~~~~~~~~~~
10:34:30 AM: npm ERR! …/src/binding.cpp:358:1: note: in expansion of macro β€˜NODE_MODULE’
10:34:30 AM: npm ERR! 358 | NODE_MODULE(binding, RegisterModule);
10:34:30 AM: npm ERR! | ^~~~~~~~~~~
10:34:30 AM: npm ERR! make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
10:34:30 AM: npm ERR! gyp ERR! build error
10:34:30 AM: npm ERR! gyp ERR! stack Error: make failed with exit code: 2
10:34:30 AM: npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/build/repo/gatsby-simplefolio/node_modules/node-gyp/lib/build.js:262:23)
10:34:30 AM: npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
10:34:30 AM: npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
10:34:30 AM: npm ERR! gyp ERR! System Linux 4.19.167+
10:34:30 AM: npm ERR! gyp ERR! command β€œ/opt/buildhome/.nvm/versions/node/v16.9.1/bin/node” β€œ/opt/build/repo/gatsby-simplefolio/node_modules/node-gyp/bin/node-gyp.js” β€œrebuild” β€œβ€“verbose” β€œβ€“libsass_ext=” β€œβ€“libsass_cflags=” β€œβ€“libsass_ldflags=” β€œβ€“libsass_library=”
10:34:30 AM: npm ERR! gyp ERR! cwd /opt/build/repo/gatsby-simplefolio/node_modules/node-sass
10:34:30 AM: npm ERR! gyp ERR! node -v v16.9.1
10:34:30 AM: npm ERR! gyp ERR! node-gyp -v v3.8.0
10:34:30 AM: npm ERR! gyp ERR! not ok
10:34:30 AM: npm ERR! Build failed with error code: 1
10:34:30 AM: npm ERR! A complete log of this run can be found in:
10:34:30 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-09-14T08_34_30_766Z-debug.log
10:34:30 AM: Error during NPM install
10:34:30 AM: Build was terminated: Build script returned non-zero exit code: 1
10:34:30 AM: Failing build: Failed to build site
10:34:31 AM: Finished processing build request in 4m15.154773216s

The version of node-sass you are using is incompatible with the version of Node (v16+) used in the build image (see compatibility list here.) You need to either upgrade the version of Node Sass you are using to v6.0+ (which may impact other dependencies in your project) or use NODE_VERSION environment variable to downgrade node to v14.17.6 which is compatible with the version of Node Sass you are currently using.

great! it deployed but now it says page not found!

https://flamboyant-dubinsky-5d0915.netlify.app/

What is the publish directory set to in your build settings?

i’ve set it to this gatsby-simplefolio/

however it doesnt show once i come out of edit details

I believe the build directory is public (inside gatsby-simplefolio), therefore set gatsby-simplefolio/public/ to the publish directory.

just did, do i need to deploy again or will it automatically update ?

Still wont load page

yes, you will need to deploy again.

2 Likes