#Error: While building SSR

4 messages · Page 1 of 1 (latest)

sharp haven
#

In angular 17 project when I run ng build I got this error

ERROR Z {
  headers: n {
    normalizedNames: Map(0) {},
    lazyUpdate: null,
    headers: Map(0) {}
  },
  status: 0,
  statusText: 'Unknown Error',
  url: '/assets/i18n/.json',
  ok: false,
  name: 'HttpErrorResponse',
  message: 'Http failure response for /assets/i18n/.json: 0 undefined',
  error: TypeError: Failed to parse URL from /assets/i18n/.json
      at Object.fetch (node:internal/deps/undici/undici:11372:11) {
    [cause]: TypeError: Invalid URL
        at new URL (node:internal/url:775:36)
        at new _Request (node:internal/deps/undici/undici:5055:25)
        at fetch2 (node:internal/deps/undici/undici:9195:25)
        at Object.fetch (node:internal/deps/undici/undici:11370:18)
        at fetch (node:internal/process/pre_execution:282:25)
        at patchedFetch (/media/asmaa/storage/workspace/develop-network/beitseeker-ng-17/node_modules/@angular-devkit/build-angular/src/utils/server-rendering/fetch-patch.js:42:20)
        at file:///media/asmaa/storage/workspace/develop-network/beitseeker-ng-17/.angular/prerender-root/d0f9a8b5-3267-44dd-9aa5-a50559300a89/polyfills.server.mjs:4:3169
        at c.<computed> (file:///media/asmaa/storage/workspace/develop-network/beitseeker-ng-17/.angular/prerender-root/d0f9a8b5-3267-44dd-9aa5-a50559300a89/polyfills.server.mjs:3:13167)
        at e.<anonymous> (file:///media/asmaa/storage/workspace/develop-network/beitseeker-ng-17/.angular/prerender-root/d0f9a8b5-3267-44dd-9aa5-a50559300a89/chunk-X55EAK2P.mjs:3:11305)
        at Generator.next (<anonymous>) {
      code: 'ERR_INVALID_URL',
      input: '/assets/i18n/.json'
    }
  }
feral rapids
#

Some code somewhere tries to make a http request to this url, and it doesn't exist. Locate the faulty code and fix it.

sharp haven
feral rapids
#

No, it's not. ngx-translate is supposed to download the translations for the configured language. How and where did you configure it?