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

Nx compatibility #156

Open
osnoser1 opened this issue Jul 20, 2024 · 3 comments
Open

Nx compatibility #156

osnoser1 opened this issue Jul 20, 2024 · 3 comments
Labels

Comments

@osnoser1
Copy link

Is your feature request related to a problem? Please describe.
I'm trying to deploy an angular app with ssr using nx and netlify and I get an error because it doesn't find the angular.json file, and that is because the file was renamed to project.json file.

Describe the solution you'd like
Allow to specify the angular.json name or try to find a project.json file.

Additional context

Plugin "@netlify/angular-runtime" failed                      
9:19:03 PM: ────────────────────────────────────────────────────────────────
9:19:03 PM: ​
9:19:03 PM:   Error message
9:19:03 PM:   Error: Could not locate your angular.json at your project root or two levels above your publish directory. Make sure your publish directory is set to "{PATH_TO_YOUR_SITE}/dist/{YOUR_PROJECT_NAME}/browser", where {YOUR_PROJECT_NAME} is 'defaultProject' in your angular.json.
9:19:03 PM: ​
9:19:03 PM:   Plugin details
9:19:03 PM:   Package:        @netlify/angular-runtime
9:19:03 PM:   Version:        2.1.0
9:19:03 PM:   Repository:     git+https://github.com/netlify/angular-runtime.git
9:19:03 PM:   npm link:       https://www.npmjs.com/package/@netlify/angular-runtime
9:19:03 PM:   Report issues:  https://github.com/netlify/angular-runtime/issues
9:19:03 PM: ​
9:19:03 PM:   Error location
9:19:03 PM:   In "onPreBuild" event in "@netlify/angular-runtime" from Netlify app
9:19:03 PM: ​
9:19:03 PM:   Resolved config
9:19:03 PM:   build:
9:19:03 PM:     command: nx run sanity-example:build
9:19:03 PM:     commandOrigin: ui
9:19:03 PM:     publish: /opt/build/repo/dist/apps/sanity-example
9:19:03 PM:     publishOrigin: ui
9:19:03 PM:   plugins:
9:19:03 PM:     - inputs: {}
9:19:03 PM:       origin: ui
9:19:03 PM:       package: '@netlify/angular-runtime'
9:19:03 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:19:04 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
9:19:04 PM: Failing build: Failed to build site
@serhalp serhalp added the Angular label Sep 19, 2024 — with Linear
@macgors
Copy link

macgors commented Nov 29, 2024

+1
IMO this should be supported.

@osnoser1 Could I ask you how did you overcome this issue?

@osnoser1
Copy link
Author

osnoser1 commented Dec 2, 2024

+1 IMO this should be supported.

@osnoser1 Could I ask you how did you overcome this issue?

Hi @macgors, I applied a patch here to be able to deploy with nx: https://github.com/limitless-angular/limitless-angular/blob/main/patches/%40netlify__angular-runtime.patch

@gwesterman
Copy link

I recently encountered the same issue. Netlify automatically detects an Angular application and sets the deploy runtime to Angular, enabling the @netlify/angular-runtime plugin. However, this plugin is not compatible with Nx.

The solution is straightforward:

  1. Navigate to Site configurationBuild & deployBuild settings, then click Configure
  2. At the top, you will likely see Runtime: Angular and a Remove button
  3. Click Remove, then save the updated configuration

This hands back control over the build to you, the developer.

Below are the settings I am using:

Base directory: [empty] (appears as / after saving)
Package directory: apps/my-app
Build command: nx run my-app:build:production
Publish directory: dist/apps/my-app/browser

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

No branches or pull requests

4 participants