-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Prerendering failed because of error #4413
Comments
a correction: in the app.module.ts I used PaginationModule.forRoot() not AlertModule.forRoot() |
I can confirm that I have this issue also. Using identical versions of Angular, NGX-Bootsrtap 3.0.1, and Bootstrap 4.1.1. However this is working in a different ssr project that doesn't use the default template, and is in fact using angular 6. I simply created my own pagination component for the angular 5 spa template, so not really an issue for me, just thought I'd mention it. |
soon be fixed in new release |
do you have an update on this topic? |
I am using Visual studio 2017 for asp.net 2.1 angular spa template with server side rendering.
following is the codes in package.json:
{
"name": "p18",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --extract-css",
"build": "ng build --extract-css",
"build:ssr": "npm run build -- --app=ssr --output-hashing=media",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/platform-server": "^5.2.0",
"@angular/router": "^5.2.0",
"@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.5",
"aspnet-prerendering": "^3.0.1",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"ngx-bootstrap": "^2.0.5",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "~1.7.0",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
},
"optionalDependencies": {
"node-sass": "^4.9.0"
}
}
codes in app.module.ts
@NgModule({
declarations: [
AppComponent,
NavMenuComponent,
HomeComponent,
CounterComponent,
FetchDataComponent
],
imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
SharedModule,
RegModule,
HttpClientModule,
AlertModule.forRoot(),
AppRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
the project works fine in development mode. The publishing with visual studio 2017 finished without error. However After I moved the published files to the IIS server. The project could not start.
Following is the error message in log:
Microsoft.AspNetCore.NodeServices.HostingModels.NodeInvocationException: Prerendering failed because of error: C:\web1\ClientApp\node_modules\ngx-bootstrap\pagination\pagination.component.js:1
(function (exports, require, module, __filename, __dirname) { import { Component, ElementRef, EventEmitter, Input, Output, Renderer2, forwardRef, ChangeDetectorRef } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:537:28)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.mRvH (C:\web1\ClientApp\dist-server\main.bundle.js:1:631226)
Current directory is: C:\web1
When I remove the ngx-bootstrap from the project, the project works fine on iis server. It seems an issue from ngx-bootstrap. It would be appreciated if you can help me to fix the issue.
The text was updated successfully, but these errors were encountered: