universal-starter icon indicating copy to clipboard operation
universal-starter copied to clipboard

Translate Service NullInjection problem while prerendering

Open abdurrahmanarikan opened this issue 3 years ago • 2 comments

Hi When we prerender the angular repo, we always get below error message:

NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST!

those are our pretender and translate service files

prerenter.ts

import { environment } from './src/environments/environment';

// for debug
require('source-map-support').install();

const domino = require('domino');
const fs = require('fs');
const path = require('path');
const template = fs.readFileSync(path.join(__dirname, '.', 'dist', 'index.html')).toString();
const win = domino.createWindow(template);
const files = fs.readdirSync(`${process.cwd()}/dist-server`);

global['window'] = win;
Object.defineProperty(win.document.body.style, 'transform', {
  value: () => {
    return {
      enumerable: true,
      configurable: true,
    };
  },
});
global['document'] = win.document;
global['CSS'] = null;
// global['XMLHttpRequest'] = require('xmlhttprequest').XMLHttpRequest;
global['Prism'] = null;

// Load zone.js for the server.
import 'zone.js/dist/zone-node';
import 'reflect-metadata';
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
import { join } from 'path';

import { enableProdMode } from '@angular/core';
// Faster server renders w/ Prod mode (dev mode never needed)
enableProdMode();

// Express Engine
import { ngExpressEngine } from '@nguniversal/express-engine';
// Import module map for lazy loading
import { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
import { renderModuleFactory } from '@angular/platform-server';
import { ROUTES } from './static.paths';

// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const mainFiles = files.filter((file) => file.startsWith('main'));
const hash = mainFiles[0].split('.')[1];
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require(`./dist-server/main.${hash}`);
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
import { NgxRequest, NgxResponce } from '@gorniv/ngx-universal';

const BROWSER_FOLDER = join(process.cwd(), 'static');

// Load the index.html file containing referances to your application bundle.
const index = readFileSync(join('dist', 'index.html'), 'utf8');

let previousRender = Promise.resolve();

// Iterate each route path
ROUTES.forEach((route) => {
  const fullPath = join(BROWSER_FOLDER, route);

  // Make sure the directory structure is there
  if (!existsSync(fullPath)) {
    let syncpath = BROWSER_FOLDER;
    route.split('/').forEach((element) => {
      syncpath = join(syncpath, element);
      if (!existsSync(syncpath)) {
        mkdirSync(syncpath);
      }
    });
  }

  // Writes rendered HTML to index.html, replacing the file if it already exists.
  previousRender = previousRender
    .then((_) =>
      renderModuleFactory(AppServerModuleNgFactory, {
        document: index,
        url: route,
        extraProviders: [
          provideModuleMap(LAZY_MODULE_MAP),
          {
            provide: REQUEST,
            useValue: { cookie: '', headers: {} },
          },
          {
            provide: RESPONSE,
            useValue: {},
          },
          {
            provide: NgxRequest,
            useValue: { cookie: '', headers: {} },
          },
          {
            provide: NgxResponce,
            useValue: {},
          },
          {
            provide: 'ORIGIN_URL',
            useValue: environment.host,
          },
        ],
      }),
    )
    .then((html) => writeFileSync(join(fullPath, 'index.html'), html));
});

translatesservice.ts

import { Injectable, Inject, PLATFORM_ID } from '@angular/core';
import { DOCUMENT, isPlatformBrowser, isPlatformServer } from '@angular/common';
import { REQUEST } from '@nguniversal/express-engine/tokens';
import {
  TranslateService as NGXTranslateService,
  MissingTranslationHandler,
  MissingTranslationHandlerParams
} from '@ngx-translate/core';
import { MetaService } from '@ngx-meta/core';
import { Observable, of } from 'rxjs';

import { ILang } from './translates.interface';
import { UniversalStorage } from '@shared/storage/universal.storage';

const LANG_LIST: ILang[] = [
  {
    code: 'en',
    name: 'English',
    culture: 'en-US'
  },
  {
    code: 'ru',
    name: 'Русский',
    culture: 'ru-RU'
  }
];
const LANG_DEFAULT: ILang = LANG_LIST[0];
const STORAGE_LANG_NAME: string = 'langCode';

@Injectable()
export class TranslatesService {
  constructor(
    @Inject(PLATFORM_ID) private _platformId: Object,
    @Inject(DOCUMENT) private _document: any,
    @Inject(REQUEST) private _request: any,
    @Inject(NGXTranslateService) private _translate: NGXTranslateService,
    @Inject(MetaService) private _meta: MetaService,
    @Inject(REQUEST) private _req: any,
    @Inject(UniversalStorage) private _appStorage: Storage
  ) { }

  public initLanguage(): Promise<any> {
    return new Promise((resolve: Function) => {
      this._translate.addLangs(LANG_LIST.map((lang: ILang) => lang.code));
      const language: ILang = this._getLanguage();
      if (language) {
        this._translate.setDefaultLang(language.code);
      } else {
        this._translate.setDefaultLang(LANG_DEFAULT.code);
      }
      this._setLanguage(language);
      resolve();
    });
  }

  private _getLanguage(): ILang {
    // fix init cookie
    this._req.cookie = this._req.headers['cookie'];

    let language: ILang = this._getFindLang(this._appStorage.getItem(STORAGE_LANG_NAME));
    if (language) {
      return language;
    }
    if (isPlatformBrowser(this._platformId)) {
      language = this._getFindLang(this._translate.getBrowserLang());
    }
    if (isPlatformServer(this._platformId)) {
      try {
        const reqLangList: string[] = this._request.headers['accept-language'].split(';')[0].split(',');
        language = LANG_LIST.find(
          (lang: ILang) => reqLangList.indexOf(lang.code) !== -1 || reqLangList.indexOf(lang.culture) !== -1
        );
      } catch (err) {
        language = LANG_DEFAULT;
      }
    }
    language = language || LANG_DEFAULT;
    this._appStorage.setItem(STORAGE_LANG_NAME, language.code);
    return language;
  }

  private _getFindLang(code: string): ILang | null {
    return code ? LANG_LIST.find((lang: ILang) => lang.code === code) : null;
  }

  private _setLanguage(lang: ILang): void {
    this._translate.use(lang.code).subscribe(() => {
      this._meta.setTag('og:locale', lang.culture);
      this._document.documentElement.lang = lang.code;
    });
  }

  public changeLang(code: string): void {
    const lang: ILang = this._getFindLang(code);
    if (!lang || lang.code === this._translate.currentLang) {
      return;
    }
    this._appStorage.setItem(STORAGE_LANG_NAME, lang.code);
    this._setLanguage(lang);
  }

  public getLangList(): Observable<ILang[]> {
    return of(LANG_LIST);
  }

  public getCurrentLang(): string {
    return this._translate.currentLang;
  }
}

export class CommonMissingTranslationHandler implements MissingTranslationHandler {
  handle(params: MissingTranslationHandlerParams) {
    if (
      params.key.match(/\w+\.\w+/) &&
      params.translateService.translations['ru'] &&
      !params.translateService.translations['ru'][params.key]
    ) {
      console.warn(`Нехватает перевода для "${params.key}"`);
    }
    return params.key;
  }
}

Could you help ?

abdurrahmanarikan avatar Apr 09 '21 12:04 abdurrahmanarikan

your latest update also gives an error once a pretender triggered from the terminal:

` arikan universal-starter-ru git:(master) npm i npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated [email protected]: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.

[email protected] postinstall ngcc

Compiling @angular/core : fesm2015 as esm2015 Compiling @angular/animations : fesm2015 as esm2015 Compiling @angular/compiler/testing : fesm2015 as esm2015 Compiling @angular/service-worker/config : fesm2015 as esm2015 Compiling @angular/animations : esm2015 as esm2015 Compiling @angular/animations : main as umd Compiling @angular/service-worker/config : esm2015 as esm2015 Compiling @angular/service-worker/config : main as umd Compiling @angular/compiler/testing : esm2015 as esm2015 Compiling @angular/compiler/testing : main as umd Compiling @angular/core/testing : fesm2015 as esm2015 Compiling @angular/animations/browser : fesm2015 as esm2015 Compiling @nguniversal/express-engine/tokens : fesm2015 as esm2015 Compiling @angular/common : fesm2015 as esm2015 Compiling @angular/platform-browser : fesm2015 as esm2015 Compiling @angular/common/http : fesm2015 as esm2015 Compiling @angular/router : fesm2015 as esm2015 Compiling @angular/platform-browser-dynamic : fesm2015 as esm2015 Compiling @angular/platform-browser/animations : fesm2015 as esm2015 Compiling @angular/platform-browser/testing : fesm2015 as esm2015 Compiling @angular/common/testing : fesm2015 as esm2015 Compiling @angular/platform-server : fesm2015 as esm2015 Compiling @angular/platform-browser-dynamic/testing : fesm2015 as esm2015 Compiling @ngx-translate/core : fesm2015 as esm2015 Compiling @gorniv/ngx-universal : fesm2015 as esm2015 Compiling @ngx-meta/core : fesm2015 as esm2015 Compiling @angular/animations/browser/testing : fesm2015 as esm2015 Compiling @angular/common/http/testing : fesm2015 as esm2015 Compiling @angular/forms : fesm2015 as esm2015 Compiling @angular/router/testing : fesm2015 as esm2015 Compiling @angular/service-worker : fesm2015 as esm2015 Compiling @nguniversal/common/engine : fesm2015 as esm2015 Compiling @angular/platform-server/testing : fesm2015 as esm2015 Compiling @nguniversal/common : fesm2015 as esm2015 Compiling @ngx-translate/http-loader : fesm2015 as esm2015 Compiling @angular/core : esm2015 as esm2015 Compiling @angular/animations/browser : esm2015 as esm2015 Compiling @angular/animations/browser : main as umd Compiling @angular/core : main as umd Compiling @nguniversal/express-engine : fesm2015 as esm2015 Compiling @angular/animations/browser/testing : esm2015 as esm2015 Compiling @angular/animations/browser/testing : main as umd Compiling @angular/common : esm2015 as esm2015 Compiling @angular/common : main as umd Compiling @angular/common/http : esm2015 as esm2015 Compiling @angular/common/http : main as umd Compiling @angular/common/http/testing : esm2015 as esm2015 Compiling @angular/common/http/testing : main as umd Compiling @angular/forms : esm2015 as esm2015 Compiling @angular/forms : main as umd Compiling @angular/core/testing : esm2015 as esm2015 Compiling @angular/core/testing : main as umd Compiling @angular/platform-browser : esm2015 as esm2015 Compiling @angular/platform-browser-dynamic : esm2015 as esm2015 Compiling @angular/platform-browser : main as umd Compiling @angular/platform-browser/testing : esm2015 as esm2015 Compiling @angular/platform-browser-dynamic : main as umd Compiling @angular/platform-browser/testing : main as umd Compiling @angular/platform-browser-dynamic/testing : esm2015 as esm2015 Compiling @angular/platform-browser-dynamic/testing : main as umd Compiling @angular/platform-browser/animations : esm2015 as esm2015 Compiling @angular/platform-browser/animations : main as umd Compiling @angular/platform-server : esm2015 as esm2015 Compiling @angular/platform-server : main as umd Compiling @angular/platform-server/testing : esm2015 as esm2015 Compiling @angular/platform-server/testing : main as umd Compiling @angular/common/testing : esm2015 as esm2015 Compiling @angular/common/testing : main as umd Compiling @angular/router : esm2015 as esm2015 Compiling @angular/router/testing : esm2015 as esm2015 Compiling @angular/router : main as umd Compiling @angular/router/testing : main as umd Compiling @angular/service-worker : esm2015 as esm2015 Compiling @angular/service-worker : main as umd Compiling @gorniv/ngx-universal : fesm5 as esm5 Compiling @gorniv/ngx-universal : esm2015 as esm2015 Compiling @gorniv/ngx-universal : esm5 as esm5 Compiling @gorniv/ngx-universal : main as umd Compiling @nguniversal/common : esm2015 as esm2015 Compiling @nguniversal/common : main as umd Compiling @nguniversal/common/engine : esm2015 as esm2015 Compiling @nguniversal/express-engine/tokens : esm2015 as esm2015 Compiling @nguniversal/common/engine : main as umd Compiling @nguniversal/express-engine : esm2015 as esm2015 Compiling @nguniversal/express-engine/tokens : main as umd Compiling @nguniversal/express-engine : main as umd Compiling @ngx-meta/core : fesm5 as esm5 Compiling @ngx-meta/core : esm2015 as esm2015 Compiling @ngx-meta/core : esm5 as esm5 Compiling @ngx-meta/core : main as umd Compiling @ngx-translate/core : esm2015 as esm2015 Compiling @ngx-translate/core : main as umd Compiling @ngx-translate/http-loader : esm2015 as esm2015 Compiling @ngx-translate/http-loader : main as umd

added 2200 packages, and audited 2201 packages in 57s

109 packages are looking for funding run npm fund for details

35 vulnerabilities (7 low, 14 moderate, 12 high, 2 critical)

To address issues that do not require attention, run: npm audit fix

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details. ➜ universal-starter-ru git:(master) ✗ npm run prerender

[email protected] prerender ng run universal-demo:prerender

Option "extractCss" is deprecated: Deprecated since version 11.0. No longer required to disable CSS extraction for HMR. ✔ Browser application bundle generation complete. ✔ Copying assets complete. ✔ Index html generation complete.

Initial Chunk Files | Names | Size main.7d6116adc02e156d9576.js | main | 464.90 kB polyfills-es5.ca2caaf6edba96f233f2.js | polyfills-es5 | 211.88 kB polyfills.2e74be917fcf4f3c5022.js | polyfills | 126.17 kB runtime.f6fa8b011018197dc8bf.js | runtime | 2.42 kB

                                  | Initial Total | 805.37 kB

Lazy Chunk Files | Names | Size 1.3efc4fa15359c28e846a.js | - | 38.17 kB 10.029c3e09e18588faac72.js | - | 4.41 kB 8.ee5bf843d30eca240f44.js | - | 2.75 kB 7.bc852676e1435bdc799c.js | - | 2.47 kB 2.d51655fe306e21da9139.js | - | 2.46 kB 6.e8a6d8e978d0f3c89552.js | - | 2.08 kB 9.de2e9956079f23fbb616.js | - | 1.84 kB 11.b9e365d3c065dbddd408.js | - | 1.55 kB 12.074572ac7b258ef43e9a.js | - | 1.18 kB

Build at: 2021-06-22T10:11:33.510Z - Hash: 3a92b263d28b88b8e254 - Time: 89553ms ✔ Server application bundle generation complete.

Initial Chunk Files | Names | Size main.js | main | 4.52 MB

                | Initial Total | 4.52 MB

Build at: 2021-06-22T10:11:37.093Z - Hash: 56cd3d2c247f628d5528 - Time: 86876ms ⠏ Prerendering 11 route(s) to /Users/user/Developer/yoauto/universal-starter-ru/dist...Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) ✖ Prerendering routes to /Users/user/Developer/yoauto/universal-starter-ru/dist failed. Unable to render /Users/user/Developer/yoauto/universal-starter-ru/dist/index.html. Error: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) Error: write EPIPE at process.target._send (internal/child_process.js:832:20) at process.target.send (internal/child_process.js:703:19) at /Users/user/Developer/modules/builders/src/prerender/render.ts:108:15 at Generator.throw () at rejected (/Users/user/Developer/yoauto/universal-starter-ru/node_modules/@nguniversal/builders/src/prerender/render.js:12:65) at ZoneDelegate.invoke (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2822151) at Zone.run (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2814514) at /Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2840753 at ZoneDelegate.invokeTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2823083) at Zone.runTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2815597) Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) ➜ universal-starter-ru git:(master) ✗ Error: write EPIPE at process.target._send (internal/child_process.js:832:20) at process.target.send (internal/child_process.js:703:19) at /Users/user/Developer/modules/builders/src/prerender/render.ts:108:15 at Generator.throw () at rejected (/Users/user/Developer/yoauto/universal-starter-ru/node_modules/@nguniversal/builders/src/prerender/render.js:12:65) at ZoneDelegate.invoke (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2822151) at Zone.run (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2814514) at /Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2840753 at ZoneDelegate.invokeTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2823083) at Zone.runTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2815597) Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) Error: write EPIPE at process.target._send (internal/child_process.js:832:20) at process.target.send (internal/child_process.js:703:19) at /Users/user/Developer/modules/builders/src/prerender/render.ts:108:15 at Generator.throw () at rejected (/Users/user/Developer/yoauto/universal-starter-ru/node_modules/@nguniversal/builders/src/prerender/render.js:12:65) at ZoneDelegate.invoke (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2822151) at Zone.run (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2814514) at /Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2840753 at ZoneDelegate.invokeTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2823083) at Zone.runTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2815597) Unhandled Promise rejection: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! ; Zone: ; Task: Promise.then ; Value: Error [NullInjectorError]: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) { ngTempTokenPath: null, ngTokenPath: [ 'ApplicationModule', 'ApplicationRef', 'ApplicationInitStatus', 'InjectionToken Application Initializer', '[object Object]', 'TranslatesService', 'InjectionToken REQUEST', 'InjectionToken REQUEST', 'InjectionToken REQUEST' ] } NullInjectorError: R3InjectorError(AppServerModule)[ApplicationModule -> ApplicationRef -> ApplicationInitStatus -> InjectionToken Application Initializer -> [object Object] -> TranslatesService -> InjectionToken REQUEST -> InjectionToken REQUEST -> InjectionToken REQUEST]: NullInjectorError: No provider for InjectionToken REQUEST! at NullInjector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1509533) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512578) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) at Module.ɵɵinject (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436238) at Object.TranslatesService_Factory [as factory] (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1910442) at R3Injector.hydrate (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1515854) at R3Injector.get (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1512370) at injectInjectorOnly (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:1436009) Error: write EPIPE at process.target._send (internal/child_process.js:832:20) at process.target.send (internal/child_process.js:703:19) at /Users/user/Developer/modules/builders/src/prerender/render.ts:108:15 at Generator.throw () at rejected (/Users/user/Developer/yoauto/universal-starter-ru/node_modules/@nguniversal/builders/src/prerender/render.js:12:65) at ZoneDelegate.invoke (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2822151) at Zone.run (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2814514) at /Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2840753 at ZoneDelegate.invokeTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2823083) at Zone.runTask (/Users/user/Developer/yoauto/universal-starter-ru/dist-server/main.js:1:2815597) `

abdurrahmanarikan avatar Jun 22 '21 10:06 abdurrahmanarikan

Hi @abdurrahmanarikan , please check my PR

kidqn avatar Jan 04 '23 07:01 kidqn