Angular deployment issue

Hello everyone,
I’m trying to deploy angular app but I’m having this issue.
The build folder is in dist/defi but the error tellme to change it to /dist/defi/browser.
& when I perform this change, I’m having an error which says that the folder /dist/defi/browser does not exists…

Can someone help me please?

image
Plugin “@netlify/angular-runtime” failed
11:04:50 PM: ────────────────────────────────────────────────────────────────
11:04:50 PM: ​
11:04:50 PM: Error message
11:04:50 PM: Error: Publish directory is configured incorrectly. Please set it to “dist/defi/browser”.
11:04:50 PM: ​
11:04:50 PM: Plugin details
11:04:50 PM: Package: @netlify/angular-runtime
11:04:50 PM: Version: 2.0.2
11:04:50 PM: Repository: git+https://github.com/netlify/angular-runtime.git
11:04:50 PM: npm link: @netlify/angular-runtime - npm
11:04:50 PM: Report issues: Issues · netlify/angular-runtime · GitHub
11:04:50 PM: ​
11:04:50 PM: Error location
11:04:50 PM: In “onPreBuild” event in “@netlify/angular-runtime” from Netlify app
11:04:50 PM: ​
11:04:50 PM: Resolved config
11:04:50 PM: build:
11:04:50 PM: command: ng build
11:04:50 PM: commandOrigin: config
11:04:50 PM: publish: /opt/build/repo/dist/defi
11:04:50 PM: publishOrigin: config
11:04:50 PM: plugins:
11:04:50 PM: - inputs: {}
11:04:50 PM: origin: ui
11:04:50 PM: package: “@netlify/angular-runtime”
11:04:50 PM: redirects:
11:04:50 PM: - from: /*
status: 200
to: /index.html
redirectsOrigin: config
11:04:50 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:04:50 PM: Failing build: Failed to build site
11:04:50 PM: Finished processing build request in 39.376s

take a look here please. would you mind also sharing your site name if you are still experiencing this issue.

Thanks for your message, but I already tried it and I have the same error:

11:35:23 AM: Error: Publish directory is configured incorrectly. Please set it to “dist/defi/browser/browser”.
image

You still haven’t shared the site name.

Here is the website link: https://celadon-strudel-94430d.netlify.app/

But it’s not working because the deployment is buggy

You’ve not set the publish directory correct;y: Build & deploy | Site configuration | celadon-strudel-94430d | Netlify. Please change that.

I changed the deployment but it’s still the same :confused:


Howdy @imad ,

Do you have publish directory configured in your netlify.toml file? If so, that will override whatever is configured in the UI so you’ll need to make the change in that file.

Let us know how it goes!

Thanks for your answer @audrey
I do not have any netlify.toml file in my project.
It’s very weird. I need your support to investigate on this issue please it’s been almost 1 week and I’m stuck…

Based on your deploy logs: Deploy details | Deploys | celadon-strudel-94430d | Netlify, you do have a netlify.toml where you’re setting a custom publish directory. This is also indicated here:

image

@hrishikesh
My bad I thought that I removed it.
Here is my netlify.toml file:

[build]
publish = "dist/defi/browser"
command = "ng build"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200

Angular.json:

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/defi/browser",
            "index": "src/index.html",
            "main": "src/main.ts",

And a screenshot of my build config:

Actually with all of these I’m getting this error:

❯ Loading plugins
12:49:04 PM:    - @netlify/angular-runtime@2.0.2 from Netlify app
12:49:05 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
12:49:05 PM: ​
12:49:05 PM: @netlify/angular-runtime (onPreBuild event)                   
12:49:05 PM: ────────────────────────────────────────────────────────────────
12:49:05 PM: ​
12:49:05 PM: ​
12:49:05 PM: Plugin "@netlify/angular-runtime" failed                      
12:49:05 PM: ────────────────────────────────────────────────────────────────
12:49:05 PM: ​
12:49:05 PM:   Error message
12:49:05 PM:   Error: Publish directory is configured incorrectly. Please set it to "dist/defi/browser/browser".
12:49:05 PM: ​
12:49:05 PM:   Plugin details
12:49:05 PM:   Package:        @netlify/angular-runtime
12:49:05 PM:   Version:        2.0.2
12:49:05 PM:   Repository:     git+https://github.com/netlify/angular-runtime.git
12:49:05 PM:   npm link:       https://www.npmjs.com/package/@netlify/angular-runtime
12:49:05 PM:   Report issues:  https://github.com/netlify/angular-runtime/issues

The browser as the end is added by us: angular-runtime/src/helpers/fixOutputDir.js at main · netlify/angular-runtime (github.com).

So if you really wish Angular to export your site to /dist/defi/browser, simply change your publish path to /dist/defi/browser/browser. If not, remove the /browser from your Angular config.

Ok now I removed netlify.toml & removed /browser from angular.json. But i’m having another error:
It was so easy to deploy an angular app on netlify by the past, I dunno what happenned


3:00:19 PM: Failed during stage "building site": Build script returned non-zero exit code: 2
3:00:18 PM: Deploy site                                                   
3:00:18 PM: ────────────────────────────────────────────────────────────────
3:00:18 PM: ​
3:00:18 PM: Section completed: deploying
3:00:18 PM: ​
3:00:18 PM: Configuration error                                           
3:00:18 PM: ────────────────────────────────────────────────────────────────
3:00:18 PM: ​
3:00:18 PM:   Error message
3:00:18 PM:   Deploy did not succeed: Deploy directory "dist/defi/browser" does not exist
3:00:18 PM: ​
3:00:18 PM:   Resolved config
3:00:18 PM:   build:
3:00:18 PM:     command: ng build
3:00:18 PM:     commandOrigin: ui
3:00:18 PM:     publish: /opt/build/repo/dist/defi/browser
3:00:18 PM:     publishOrigin: ui
3:00:18 PM:   plugins:
3:00:18 PM:     - inputs: {}
3:00:18 PM:       origin: ui
3:00:18 PM:       package: "@netlify/angular-runtime"
3:00:19 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:00:19 PM: Failing build: Failed to build site

Okay, now we indeed have a weird error. Can you share your repo so we can check this?

You mean my github repo ?
It’s private, how can I share it to you?

You can add Hrishkesh-K to the repo: Hrishikesh-K (Hrishikesh Kokate) (github.com)

ok It’s done, you should be able to access to the project

Thanks, I just tried your repo and something is wrong on our end. I’m not sure why the plugin is adding the browser to the path. But for you, the solution would be to go to build settings: Build & deploy | Site configuration | celadon-strudel-94430d | Netlify, choose edit, and from the Runtime, click on Remove:

Then you should be able to deploy your site.

Ok thx it’s working now

glad to hear it you got it sorted.