# Error Build NestJS Api

**URL:** <https://answers.netlify.com/t/error-build-nestjs-api/131293>\
**Category:** Support\
**Tags:** deployment, netlify-api, building\
**Created:** [December 4, 2024, 11:14am UTC](https://answers.netlify.com/t/error-build-nestjs-api/131293 "2024-12-04T11:14:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaupher](https://avatars.discourse-cdn.com/v4/letter/k/b9e5f3/32.png) [@Klaupher](https://answers.netlify.com/u/Klaupher)\
**Post date:** [December 4, 2024, 11:14am UTC](https://answers.netlify.com/t/error-build-nestjs-api/131293/1 "2024-12-04T11:14:06Z")

</div>

Hello…  
I’m trying to publish my Rest API ([https://geobase-maluju.netlify.app](https://geobase-maluju.netlify.app)), developed in NestJs, but every time I deploy it I always get the same error:

```auto
8:01:09 AM: $ yarn install; yarn build
8:01:10 AM: yarn install v1.22.19
8:01:10 AM: info No lockfile found.
8:01:10 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
8:01:10 AM: [1/4] Resolving packages...
8:01:13 AM: warning aws-lambda > aws-sdk > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
8:01:13 AM: warning aws-lambda > aws-sdk > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
8:01:15 AM: warning @nestjs/cli > fork-ts-checker-webpack-plugin > memfs@3.6.0: this will be v4
8:01:19 AM: warning jest > @jest/core > jest-config > glob@7.2.3: Glob versions prior to v9 are no longer supported
8:01:19 AM: warning jest > @jest/core > jest-runtime > glob@7.2.3: Glob versions prior to v9 are no longer supported
8:01:19 AM: warning jest > @jest/core > @jest/reporters > glob@7.2.3: Glob versions prior to v9 are no longer supported
8:01:19 AM: warning jest > @jest/core > jest-config > glob > inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
8:01:20 AM: warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > glob@7.2.3: Glob versions prior to v9 are no longer supported
8:01:22 AM: [2/4] Fetching packages...
8:01:34 AM: [3/4] Linking dependencies...
8:01:34 AM: warning " > serverless-offline@14.3.4" has unmet peer dependency "serverless@^4.0.0".
8:01:34 AM: warning " > ts-loader@9.5.1" has unmet peer dependency "webpack@^5.0.0".
8:01:39 AM: [4/4] Building fresh packages...
8:01:41 AM: success Saved lockfile.
8:01:41 AM: Done in 31.10s.
8:01:41 AM: yarn run v1.22.19
8:01:41 AM: $ nest build && cp src/main.handler.ts dist/src
8:01:43 AM: src/geocicle/geocicle.module.ts:4:33 - error TS2307: Cannot find module '@app/geocicle/geoCicle.service' or its corresponding type declarations.
8:01:43 AM: 4 import { GeoCicleService } from '@app/geocicle/geoCicle.service';
8:01:43 AM: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8:01:43 AM: Found 1 error(s).
8:01:43 AM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
8:01:43 AM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
8:01:43 AM: ​
8:01:43 AM: "build.command" failed                                        
8:01:43 AM: ────────────────────────────────────────────────────────────────
8:01:43 AM: ​
8:01:43 AM: Error message
8:01:43 AM: Command failed with exit code 1: yarn install; yarn build (https://ntl.fyi/exit-code-1)
8:01:43 AM: ​
8:01:43 AM: Error location
8:01:43 AM: In Build command from Netlify app:
8:01:43 AM: yarn install; yarn build
8:01:43 AM: ​
8:01:43 AM: Resolved config
8:01:43 AM: build:
8:01:43 AM: command: yarn install; yarn build
8:01:43 AM: commandOrigin: ui
8:01:43 AM: environment:
8:01:43 AM: - DATABASE_URL
8:01:43 AM: - JWT_SECRET
8:01:43 AM: publish: /opt/build/repo
8:01:43 AM: publishOrigin: default
8:01:43 AM: functions:
8:01:43 AM: '*':
8:01:43 AM: node_bundler: esbuild
8:01:43 AM: functionsDirectory: /opt/build/repo/netlify/functions
8:01:43 AM: redirects:
8:01:43 AM: - force: true
8:01:44 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:01:44 AM: from: /api/*
      status: 200
      to: /.netlify/functions/api/:splat
  redirectsOrigin: config
8:01:44 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
8:01:44 AM: Failing build: Failed to build site
8:01:44 AM: Finished processing build request in 1m31.569s

```

I configured netlify.toml:

```auto
[functions]
  node_bundler = "esbuild"
  directory = "netlify/functions"

[[redirects]]
  force = true
  from = "/api/*"
  status = 200
  to = "/.netlify/functions/api/:splat"

```

I’ve already made several adjustments, following the suggestion of other forums, like this one: [https://answers.netlify.com/t/netlify-not-deploying-anymore-module-not-found-and-typescript-types-error/123466](https://answers.netlify.com/t/netlify-not-deploying-anymore-module-not-found-and-typescript-types-error/123466).

Could someone help me and guide me?

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [December 7, 2024, 1:20pm UTC](https://answers.netlify.com/t/error-build-nestjs-api/131293/2 "2024-12-07T13:20:50Z")

</div>

Can’t say much without seeing a repo, but maybe this is relevant:

> [@\[Support Guide\] Netlify app builds locally but fails on deploy (case sensitivity)](https://answers.netlify.com/t/support-guide-netlify-app-builds-locally-but-fails-on-deploy-case-sensitivity/10754):
>
> Last updated by Netlify Support: July 2025 Are you struggling to understand why your project runs locally but errors out with missing files or logs that point toward issues with case when you try and build on Netlify? You are not alone. Often, case (as in: UPPERCASE or lowercase letters in filenames or paths) can cause problems. Here is a guide to understanding how case sensitivity issues present themselves, why they arise, and how you can fix them! 1. Errors you might see Case sensitivity iss…
