angular2-markdown package works on localhost but when I deploy on GitHub pages it gives me an error



I develop a site with Angular-CLI and will publish that on GitHub pages. the link to my project is

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

<div class="container">
    <div class="row">
        <div class="col-md-8">
            <!-- Below you see the `markdown` tag to render the markdown file -->
            <markdown path="/reports/"></markdown>
        <div class="col-md-4">

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:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { MarkdownModule } from 'angular2-markdown';
import { AppComponent } from './app.component';
    declarations: [AppComponent],
    imports: [
    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:/***/

ERROR in C:/***/ 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:/***/ Module C:/***/ has no exported member AppModule.

ERROR in C:/***/ Declaration expected.

What is normal of course.


How could I solve this problem?

Thanks in advance.


You are using 1.3.14 please use the latest version. The current version is 1.3.18

npm install angular2-markdown --save

It should fix your issue.

Answered By – Dimpu Aravind Buddha

Answer Checked By – Clifford M. (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.