Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Angular 17 SSR / SSG fails #93

Closed
nivekcode opened this issue Dec 4, 2023 · 4 comments
Closed

Deploy Angular 17 SSR / SSG fails #93

nivekcode opened this issue Dec 4, 2023 · 4 comments

Comments

@nivekcode
Copy link

Describe the bug
Hi there I generated a new Angular 17 application with the following command:

ng new my-app --ssr

I followed the instructions from this blog post: https://www.netlify.com/blog/deploy-your-angular-v17-apps-to-netlify/. Unfortunately I got the following error during deployment.

5:26:57 PM: Netlify Build                                                 
5:26:57 PM: ────────────────────────────────────────────────────────────────
5:26:57 PM: ​
5:26:57 PM: ❯ Version
5:26:57 PM:   @netlify/build 29.29.4
5:26:57 PM: ​
5:26:57 PM: ❯ Flags
5:26:57 PM:   baseRelDir: true
5:26:57 PM:   buildId: 656dfdadb754b6133966f29c
5:26:57 PM:   deployId: 656dfdadb754b6133966f29e
5:26:57 PM: ​
5:26:57 PM: ❯ Current directory
5:26:57 PM:   /opt/build/repo
5:26:57 PM: ​
5:26:57 PM: ❯ Config file
5:26:57 PM:   No config file was defined: using default values.
5:26:57 PM: ​
5:26:57 PM: ❯ Context
5:26:57 PM:   production
5:26:57 PM: ​
5:26:57 PM: ❯ Installing plugins
5:26:57 PM:    - @netlify/[email protected]
5:26:58 PM: ​
5:26:58 PM: ❯ Loading plugins
5:26:58 PM:    - @netlify/[email protected] from Netlify app
5:26:59 PM: ​
5:26:59 PM: @netlify/angular-runtime (onPreBuild event)                   
5:26:59 PM: ────────────────────────────────────────────────────────────────
5:26:59 PM: ​
5:26:59 PM: ​
5:26:59 PM: (@netlify/angular-runtime onPreBuild completed in 10ms)
5:26:59 PM: ​
5:26:59 PM: Build command from Netlify app                                
5:26:59 PM: ────────────────────────────────────────────────────────────────
5:26:59 PM: ​
5:26:59 PM: $ npm run build
5:26:59 PM: > [email protected] build
5:26:59 PM: > ng build
5:27:00 PM: - Building...
5:27:11 PM: An unexpected error occurred: [object Object]
5:27:11 PM: ​
5:27:11 PM: "build.command" failed                                        
5:27:11 PM: ────────────────────────────────────────────────────────────────
5:27:11 PM: ​
5:27:11 PM:   Error message
5:27:11 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
5:27:11 PM: ​
5:27:11 PM:   Error location
5:27:11 PM:   In Build command from Netlify app:
5:27:11 PM:   npm run build
5:27:11 PM: ​
5:27:11 PM:   Resolved config
5:27:11 PM:   build:
5:27:11 PM:     command: npm run build
5:27:11 PM:     commandOrigin: ui
5:27:11 PM:     publish: /opt/build/repo/dist/nothing-special/browser
5:27:11 PM:     publishOrigin: ui
5:27:11 PM:   plugins:
5:27:11 PM:     - inputs: {}
5:27:11 PM:       origin: ui
5:27:11 PM:       package: "@netlify/angular-runtime"
5:27:11 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:27:11 PM: Failing build: Failed to build site
5:27:12 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
5:27:12 PM: Finished processing build request in 39.131s

To Reproduce
Steps to reproduce the behavior:

  1. Generate a new Angular application
  2. Push to repo
  3. Setup Netlify deployment with defaults
  4. See error in Deployment log on build step

Expected behavior
We deploy a Angular application with SSR and SSG (hypbrid)

Versions

  • Angular 17
@Dashiman
Copy link

Have the same problem

@Skn0tt
Copy link
Contributor

Skn0tt commented Feb 1, 2024

Hey folks! Sorry for not reacting earlier on this. It seems to me that this is related to angular/angular-cli#26648, and a bug in the Angular build process that's triggered by Node.js 18.19.0. To work around this, you can either upgrade your version of Angular, or switch your site to use Node.js 20: https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript

@Skn0tt
Copy link
Contributor

Skn0tt commented Feb 1, 2024

I've tested this locally and this workaround worked for me, so i'll go ahead and close this issue. If the workarounds mentioned don't solve the issue, please leave another comment and i'll dig deeper!

@Skn0tt Skn0tt closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2024
@Skn0tt Skn0tt closed this as completed Feb 1, 2024
@Lissy93
Copy link

Lissy93 commented Jan 25, 2025

For me, removing Netlify's Angular plugin, and just specifying the output folder myself resolved this issue.

(Under build settings --> click Remove plugin)

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants