Hello i would like to deploy my GatsbyJS template site to netlify, im trying to add it to netlify but it says:
Command failed with exit code 1: gatsby develop (Search results for '"non-zero exit code: 1"' - Netlify Support Forums )
I set the build command to “gatsby develop”
I want to use this template: GitHub - konstantinmuenster/gatsby-theme-portfolio-minimal: A Gatsby Theme to create modern one-page portfolios with a clean yet expressive design.
Thanks for further responses
@DarkkQQ You do not want the build command to be gatsby develop
.
It’s intended for local development as it starts a development server.
You probably want your build command to be npm run build
.
It will run the build
script in the package.json
.
nathanmartin:
npm run build
Ok i tried that, still does not work, it said i need to set my NODE.js version to 18.0.0 i did that and now im getting there errors:
10:46:58 PM: error “gatsby-theme-portfolio-minimal” threw an error while running the createPages lifecycle:
10:46:58 PM: Cannot read properties of undefined (reading ‘path’)
10:46:58 PM:
10:46:58 PM:
10:46:58 PM: TypeError: Cannot read properties of undefined (reading ‘path’)
10:46:58 PM:
10:46:58 PM: - createPages.js:17 Object.module.exports [as createPages]
10:46:58 PM: [repo]/[gatsby-theme-portfolio-minimal]/src/gatsby/node/createPages.js:17:57
10:46:58 PM: - task_queues:95 processTicksAndRejections
10:46:58 PM: node:internal/process/task_queues:95:5
10:46:58 PM:
10:46:58 PM: - api-runner-node.js:487 runAPI
10:46:58 PM: [repo]/[gatsby]/src/utils/api-runner-node.js:487:16
10:46:58 PM:
10:46:58 PM:
10:46:58 PM: failed createPages - 0.299s
10:46:58 PM:
10:46:58 PM: “build.command” failed
10:46:58 PM: ────────────────────────────────────────────────────────────────
10:46:58 PM:
10:46:58 PM: Error message
10:46:58 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums )
10:46:58 PM:
10:46:58 PM: Error location
10:46:58 PM: In Build command from Netlify app:
10:46:58 PM: npm run build
10:46:58 PM:
10:46:58 PM: Resolved config
10:46:58 PM: build:
10:46:58 PM: command: npm run build
10:46:58 PM: commandOrigin: ui
10:46:58 PM: environment:
10:46:58 PM: - NODE_VERSION
10:46:58 PM: publish: /opt/build/repo/public
10:46:58 PM: publishOrigin: ui
10:46:58 PM: plugins:
10:46:58 PM: - inputs: {}
10:46:58 PM: origin: ui
10:46:58 PM: package: ‘@netlify /plugin-gatsby’
10:46:59 PM: Node.js v18.0.0
10:46:59 PM: node:internal/modules/cjs/loader:942
10:46:59 PM: throw err;
10:46:59 PM: ^
10:46:59 PM: Error: Cannot find module ‘./util.js’
10:46:59 PM: Require stack:
10:46:59 PM: - /opt/build/repo/node_modules/yurnalist/dist/reporters/console/console-reporter.js
10:46:59 PM: - /opt/build/repo/node_modules/yurnalist/dist/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/reporter/loggers/yurnalist/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/reporter/start-logger.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby-cli/lib/reporter/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/schema/resolvers.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/schema/extensions/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/schema/types/type-defs.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/redux/reducers/inference-metadata.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/redux/reducers/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/redux/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/utils/jobs/worker-messaging.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby/dist/utils/worker/child/index.js
10:46:59 PM: - /opt/build/repo/node_modules/gatsby-worker/dist/child.js
10:46:59 PM: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
10:46:59 PM: at Function.Module._load (node:internal/modules/cjs/loader:780:27)
10:46:59 PM: at Module.require (node:internal/modules/cjs/loader:1005:19)
10:46:59 PM: at require (node:internal/modules/cjs/helpers:102:18)
10:46:59 PM: at _load_util (/opt/build/repo/node_modules/yurnalist/dist/reporters/console/console-reporter.js:34:18)
10:46:59 PM: at ConsoleReporter.error (/opt/build/repo/node_modules/yurnalist/dist/reporters/console/console-reporter.js:267:19)
10:46:59 PM: at /opt/build/repo/node_modules/gatsby-cli/lib/reporter/loggers/yurnalist/index.js:166:13
10:46:59 PM: at dispatch (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/redux/index.js:47:5)
10:46:59 PM: at Object.createLog (/opt/build/repo/node_modules/redux/lib/redux.js:586:12)
10:46:59 PM: at Reporter.error (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/reporter.js:163:23)
10:46:59 PM: at console.error (/opt/build/repo/node_modules/gatsby-cli/lib/reporter/patch-console.js:26:14)
10:46:59 PM: at printErrorAndExit (/opt/build/repo/node_modules/@turist /fetch/dist/sourcemap-register.js:1:7058)
10:46:59 PM: at process.emit (/opt/build/repo/node_modules/@turist /fetch/dist/sourcemap-register.js:1:7292)
10:46:59 PM: at process._fatalException (node:internal/process/execution:167:25) {
10:46:59 PM: code: ‘MODULE_NOT_FOUND’,
10:46:59 PM: requireStack: [
10:46:59 PM: ‘/opt/build/repo/node_modules/yurnalist/dist/reporters/console/console-reporter.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/yurnalist/dist/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby-cli/lib/reporter/loggers/yurnalist/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby-cli/lib/reporter/start-logger.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby-cli/lib/reporter/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/schema/resolvers.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/schema/extensions/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/schema/types/type-defs.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/redux/reducers/inference-metadata.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/redux/reducers/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/redux/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/utils/jobs/worker-messaging.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby/dist/utils/worker/child/index.js’,
10:46:59 PM: ‘/opt/build/repo/node_modules/gatsby-worker/dist/child.js’
10:46:59 PM: ]
10:46:59 PM: }
That’s not quite a correct statement.
Changing npm run develop
to npm run build
did work and has fixed the first problem that you were having.
What “still does not work” is your build.
Hopefully someone else is able to help you debug your build.
SamO
January 27, 2023, 4:51pm
5
Hi @DarkkQQ , you will need to debug you build but unfortunately that is outside the scope of support. You’ll need to check out this support guide to get this working locally.
Last reviewed by Netlify Support - August, 2023
Note: This article is only about builds within Netlify’s Continuous Integration (CI) environment, as triggered from git commits or from incoming build webhooks . You can learn more in depth about how Netlify builds your site in this article about how our build bots build sites .
Some background
There are a fair number of reasons that a build could fail in Netlify’s CI environment, even if building works locally. Testing locally is always the place …
Also, it’ll help if you share the repos so other members of the community can help you debug your code. ( :