Failed during stage 'building site': Build script returned non-zero exit code: 2 Hugo Error

Please Help Me i got this error when i deploy my website
Netlify App Web https://magenta-nasturtium-d8dedf.netlify.app/

ERROR
12:42:06 AM: Netlify Build
12:42:06 AM: ────────────────────────────────────────────────────────────────
12:42:06 AM: ​
12:42:06 AM: ❯ Version
12:42:06 AM: @netlify/build 29.11.7
12:42:06 AM: ​
12:42:06 AM: ❯ Flags
12:42:06 AM: baseRelDir: true
12:42:06 AM: buildId: 647b6d15da391b1d1a2a1dd3
12:42:06 AM: deployId: 647b6d15da391b1d1a2a1dd5
12:42:06 AM: ​
12:42:06 AM: ❯ Current directory
12:42:06 AM: /opt/build/repo
12:42:06 AM: ​
12:42:06 AM: ❯ Config file
12:42:06 AM: /opt/build/repo/netlify.toml
12:42:06 AM: ​
12:42:06 AM: ❯ Context
12:42:06 AM: production
12:42:06 AM: ​
12:42:06 AM: build.command from netlify.toml
12:42:06 AM: ────────────────────────────────────────────────────────────────
12:42:06 AM: ​
12:42:06 AM: $ cd exampleSite && hugo --gc --themesDir …/…
12:42:06 AM: Total in 0 ms
12:42:06 AM: Error: module “DPSH_PROTEKSI” not found; either add it as a Hugo Module or store it in “/opt/build”.: module does not exist
12:42:06 AM: ​
12:42:06 AM: “build.command” failed
12:42:06 AM: ────────────────────────────────────────────────────────────────
12:42:06 AM: ​
12:42:06 AM: Error message
12:42:06 AM: Command failed with exit code 255: cd exampleSite && hugo --gc --themesDir …/… (Search results for '"non-zero exit code: 255"' - Netlify Support Forums)
12:42:06 AM: ​
12:42:06 AM: Error location
12:42:06 AM: In build.command from netlify.toml:
12:42:06 AM: cd exampleSite && hugo --gc --themesDir …/…
12:42:06 AM: ​
12:42:06 AM: Resolved config
12:42:06 AM: build:
12:42:06 AM: command: cd exampleSite && hugo --gc --themesDir …/…
12:42:06 AM: commandOrigin: config
12:42:07 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
12:42:06 AM: environment:
12:42:06 AM: - HUGO_VERSION
12:42:06 AM: - HUGO_THEME
12:42:06 AM: - HUGO_BASEURL
12:42:06 AM: publish: /opt/build/repo/exampleSite/public
12:42:06 AM: publishOrigin: config
12:42:07 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
12:42:07 AM: Failing build: Failed to build site
12:42:08 AM: Finished processing build request in 1m11.929s

The error is:

12:42:06 AM: Error: module “DPSH_PROTEKSI” not found; either add it as a Hugo Module or store it in “/opt/build”.: module does not exist

DPSH_PROTEKSI is probably the name of your theme.

If so, the build cannot find your theme, and thus it’s likely caused by configuration.

I can see you’re specifying --themesDir .../... (ThemesDir Docs) and that looks highly likely to be incorrect.

Can you help me how do i fix it? Thanks :pray:t2:

I don’t believe there’s a problem with the name of your theme, only that it cannot be found.

As I’ve indicated the problem is likely the --themesDir value that you’re supplying, if .../... doesn’t point to where the theme is, then it’s not going to be able to find it.

I can’t tell you how to fix it beyond that, as I have no idea what your folder structure is.

I have this error is similar with the same non-zero exit code: 2.
9:51:33 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
9:51:30 PM: Netlify Build
9:51:30 PM: ────────────────────────────────────────────────────────────────
9:51:30 PM: ​
9:51:30 PM: ❯ Version
9:51:30 PM: @netlify/build 29.17.1
9:51:30 PM: ​
9:51:30 PM: ❯ Flags
9:51:30 PM: baseRelDir: true
9:51:30 PM: buildId: 64bc332d624b41250666d51e
9:51:30 PM: deployId: 64bc332d624b41250666d520
9:51:30 PM: ​
9:51:30 PM: ❯ Current directory
9:51:30 PM: /opt/build/repo
9:51:30 PM: ​
9:51:30 PM: ❯ Config file
9:51:30 PM: No config file was defined: using default values.
9:51:30 PM: ​
9:51:30 PM: ❯ Context
9:51:30 PM: production
9:51:30 PM: ​
9:51:30 PM: Build command from Netlify app
9:51:30 PM: ────────────────────────────────────────────────────────────────
9:51:30 PM: ​
9:51:30 PM: $ npm run build
9:51:30 PM: > landing-nutrigj@0.0.1 build
9:51:30 PM: > astro build
9:51:31 PM: 07:51:31 PM [content] No content directory found. Skipping type generation.
9:51:31 PM: error Cannot destructure property ‘buildConfig’ of ‘undefined’ as it is undefined.
9:51:31 PM: File:
9:51:31 PM: /opt/build/repo/node_modules/.pnpm/@astrojs+image@0.12.1_sharp@0.31.3/node_modules/@astrojs/image/dist/index.js:66:31
9:51:31 PM: Code:
9:51:31 PM: 65 | },
9:51:31 PM: > 66 | astro:build:start: ({ buildConfig }) => {
9:51:31 PM: | ^
9:51:31 PM: 67 | var _a;
9:51:31 PM: 68 | const adapterName = (_a = _config.adapter) == null ? void 0 : _a.name;
9:51:31 PM: 69 | if (adapterName && UNSUPPORTED_ADAPTERS.has(adapterName)) {
9:51:31 PM: Stacktrace:
9:51:31 PM: TypeError: Cannot destructure property ‘buildConfig’ of ‘undefined’ as it is undefined.
9:51:31 PM: at astro:build:start (file:///opt/build/repo/node_modules/.pnpm/@astrojs+image@0.12.1_sharp@0.31.3/node_modules/@astrojs/image/dist/index.js:66:31)
9:51:31 PM: at runHookBuildStart (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/integrations/index.js:188:59)
9:51:31 PM: at AstroBuilder.build (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/core/build/index.js:84:11)
9:51:31 PM: at AstroBuilder.run (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/core/build/index.js:149:18)
9:51:31 PM: at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
9:51:31 PM: at async build (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/core/build/index.js:37:3)
9:51:31 PM: at async build (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/cli/build/index.js:7:3)
9:51:31 PM: at async runCommand (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/cli/index.js:117:7)
9:51:31 PM: at async cli (file:///opt/build/repo/node_modules/.pnpm/astro@2.9.1_sharp@0.31.3/node_modules/astro/dist/cli/index.js:155:5)
9:51:31 PM: ​
9:51:31 PM: build.command failed
9:51:31 PM: ────────────────────────────────────────────────────────────────
9:51:31 PM: ​
9:51:31 PM: Error message
9:51:31 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
9:51:31 PM: ​
9:51:31 PM: Error location
9:51:31 PM: In Build command from Netlify app:
9:51:31 PM: npm run build
9:51:31 PM: ​
9:51:31 PM: Resolved config
9:51:31 PM: build:
9:51:31 PM: command: npm run build
9:51:31 PM: commandOrigin: ui
9:51:31 PM: publish: /opt/build/repo/dist
9:51:31 PM: publishOrigin: ui
9:51:33 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:51:33 PM: Failing build: Failed to build site
9:51:33 PM: Finished processing build request in 22.926s

Someone can help me please ?

Something went wrong with either your code or Astro code. This is not a Netlify issue. Please check your code or report to Astro.