Click here to Skip to main content
15,867,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

Situation

I develop a site with Angular-CLI and will publish that on GitHub pages. the link to my project is https://heinpauwelyn.github.io.

I've installed a package named angular2-markdown to render markdown files on my HTML pages. Below you see my code:

HTML
<div class="container">
    <div class="row">
        <div class="col-md-8">
            <h2>Internship</h2>
            <!-- Below you see the `markdown` tag to render the markdown file -->
            <markdown path="/reports/intro.md"></markdown>
        </div>
        <div class="col-md-4">
            <app-reportslist></app-reportslist>
        </div>
    </div>
</div>

To test the site on localhost I use this command:

ng serve

This command gives no problem and render the markdown files good.

The problem

An error will be throw when I use command below to deploy my website on GitHub pages.

ng github-pages:deploy

This gives me next error:

ERROR in MarkdownModule is not an NgModule

Here is my code in my app.module.ts:

ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { MarkdownModule } from 'angular2-markdown';
import { AppComponent } from './app.component';

@NgModule({
    declarations: [AppComponent],
    imports: [
        BrowserModule,
        MarkdownModule
    ],
    bootstrap: [AppComponent],
})
export class AppModule { }

I've tried

Attempt one

I know on the guide stands that I must use MarkdownModule.forRoot(). If I use now ng serve, I've got this error:

ERROR in Error encountered resolving symbol values statically. Calling function MarkdownModule, function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/***/heinpauwelyn.github.io/src/app/app.module.ts.

ERROR in C:/***/heinpauwelyn.github.io/src/app/app.module.ts: Property forRoot does not exist on type typeof MarkdownModule.

Attempt two

If I comment the line export class AppModule() like in the guide, I got this error:

ERROR in C:/***/heinpauwelyn.github.io/src/main.ts: Module C:/***/heinpauwelyn.github.io/src/app/app.module.ts has no exported member AppModule.

ERROR in C:/***/heinpauwelyn.github.io/src/app/app.module.ts: Declaration expected.

What is normal of course.

Question

How could I solve this problem?

Thanks in advance.



What I have tried:

See the question to see what I've done
Posted
Updated 23-Feb-17 21:27pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900