# Error when deploy ExpressJS

**URL:** <https://answers.netlify.com/t/error-when-deploy-expressjs/101950>\
**Category:** Support\
**Tags:** netlify-newbie, building\
**Created:** [September 15, 2023, 5:05pm UTC](https://answers.netlify.com/t/error-when-deploy-expressjs/101950 "2023-09-15T17:05:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![violet](https://avatars.discourse-cdn.com/v4/letter/v/ebca7d/32.png) [@violet](https://answers.netlify.com/u/violet)\
**Post date:** [September 15, 2023, 5:05pm UTC](https://answers.netlify.com/t/error-when-deploy-expressjs/101950/1 "2023-09-15T17:05:40Z")

</div>

Admin url: [Netlify App](https://app.netlify.com/sites/astounding-tulumba-e4dc2b)  
Site url: [https://astounding-tulumba-e4dc2b.netlify.app](https://astounding-tulumba-e4dc2b.netlify.app)

I have this error in the build process:

6:19:14 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](https://ntl.fyi/exit-code-2))  
6:14:10 PM: Netlify Build  
6:14:10 PM: ────────────────────────────────────────────────────────────────  
6:14:10 PM: ​  
6:14:10 PM: ❯ Version  
6:14:10 PM: @netlify/build 29.20.12  
6:14:10 PM: ​  
6:14:10 PM: ❯ Flags  
6:14:10 PM: baseRelDir: true  
6:14:10 PM: buildId: 650482a3c3c0d94a069cae72  
6:14:10 PM: deployId: 650482a3c3c0d94a069cae74  
6:14:10 PM: ​  
6:14:10 PM: ❯ Current directory  
6:14:10 PM: /opt/build/repo  
6:14:10 PM: ​  
6:14:10 PM: ❯ Config file  
6:14:10 PM: /opt/build/repo/netlify.toml  
6:14:10 PM: ​  
6:14:10 PM: ❯ Context  
6:14:10 PM: production  
6:14:10 PM: ​  
6:14:10 PM: Build command from Netlify app  
6:14:10 PM: ────────────────────────────────────────────────────────────────  
6:14:10 PM: ​  
6:14:10 PM: $ npm run build  
6:14:11 PM: \> text-to-speech-express@1.0.0 build  
6:14:11 PM: \> netlify deploy --prod  
6:14:13 PM: Logging into your Netlify account…  
6:14:13 PM: Opening [Netlify App](https://app.netlify.com/authorize?response_type=ticket&ticket=38a8741fbf2bf63dc2c28defaa0d641a)  
6:14:13 PM: - Waiting for authorization…  
6:19:13 PM: › Error: Timed out waiting for authorization. If you do not have a Netlify account, please create one at [Netlify App](https://app.netlify.com/signup), then run netlify login again.  
6:19:13 PM: ​  
6:19:13 PM: build.command failed  
6:19:13 PM: ────────────────────────────────────────────────────────────────  
6:19:13 PM: ​  
6:19:13 PM: Error message  
6:19:13 PM: Command failed with exit code 1: npm run build ([Search results for '"non-zero exit code: 1"' - Netlify Support Forums](https://ntl.fyi/exit-code-1))  
6:19:13 PM: ​  
6:19:13 PM: Error location  
6:19:13 PM: In Build command from Netlify app:  
6:19:13 PM: npm run build  
6:19:13 PM: ​  
6:19:13 PM: Resolved config  
6:19:13 PM: build:  
6:19:13 PM: command: npm run build  
6:19:13 PM: commandOrigin: ui  
6:19:13 PM: publish: /opt/build/repo/public  
6:19:13 PM: publishOrigin: config  
6:19:13 PM: functionsDirectory: /opt/build/repo/functions  
6:19:14 PM: Build failed due to a user error: Build script returned non-zero exit code: 2  
6:19:14 PM: Failing build: Failed to build site  
6:19:15 PM: Finished processing build request in 5m37.597s

My package.json:  
{  
“name”: “text-to-speech-express”,  
“version”: “1.0.0”,  
“description”: “”,  
“main”: “functions/api.js”,  
“type”: “module”,  
“scripts”: {  
“test”: “echo "Error: no test specified" && exit 1”,  
“build”: “netlify deploy --prod”  
},  
“keywords”: ,  
“author”: “”,  
“license”: “ISC”,  
“dependencies”: {  
“@google-cloud/text-to-speech”: “^5.0.0”,  
“axios”: “^1.5.0”,  
“body-parser”: “^1.20.2”,  
“dotenv”: “^16.3.1”,  
“ejs”: “^3.1.9”,  
“express”: “^4.18.2”,  
“multer”: “^1.4.5-lts.1”,  
“netlify-cli”: “^16.3.1”,  
“netlify-lambda”: “^2.0.16”,  
“node-fetch”: “^3.3.2”,  
“openai”: “^4.0.0”,  
“serverless-http”: “^3.2.0”  
}  
}

my netlify.toml:  
[build]  
publish = “public”  
functions = “functions”

---

<div class="post-metadata">

**Author:** ![nathanmartin](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/nathanmartin/32/30845_2.png) [@nathanmartin](https://answers.netlify.com/u/nathanmartin)\
**Post date:** [September 16, 2023, 10:52am UTC](https://answers.netlify.com/t/error-when-deploy-expressjs/101950/2 "2023-09-16T10:52:01Z")

</div>

> [@violet](#):
>
> 6:14:11 PM: \> netlify deploy --prod  
> 6:14:13 PM: Logging into your Netlify account…  
> 6:14:13 PM: Opening [Netlify App](https://app.netlify.com/authorize?response_type=ticket&ticket=38a8741fbf2bf63dc2c28defaa0d641a)  
> 6:14:13 PM: - Waiting for authorization…  
> 6:19:13 PM: › Error: Timed out waiting for authorization. If you do not have a Netlify account, please create one at [Netlify App](https://app.netlify.com/signup), then run netlify login again.

You shouldn’t be running `netlify deploy` on Netlify.

You should only need to run your build, which produces output and have your **Publish directory** set correctly.

> **[Build configuration overview](https://docs.netlify.com/configure-builds/overview/)**
>
> Configure build settings for a repository that uses continuous deployment, and understand build image options for your site.
