Skip to content
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

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

Closed
HeinPauwelyn opened this issue Feb 24, 2017 · 7 comments

Comments

@HeinPauwelyn
Copy link

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:

<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:

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?

Note: See also my question on Stack Overflow

Thanks in advance.

@dimpu
Copy link
Owner

dimpu commented Feb 24, 2017

can you copy and past your package.json here.

Also, Do you have GitHub repo which I can access to see the code?

@HeinPauwelyn
Copy link
Author

Here is my repo on GitHub: https://github.com/HeinPauwelyn/heinpauwelyn.github.io

package.json:

{
  "name": "personal blog",
  "homepage": "https://heinpauwelyn.github.io",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "^3.3.1",
    "angular2-markdown": "^1.3.14",
    "core-js": "^2.4.1",
    "ng2-bootstrap": "^1.3.3",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.28.3",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3"
  }
}

@dimpu
Copy link
Owner

dimpu commented Feb 24, 2017

I see your issue now. You are using 1.3.14 please use the latest version.

the current version is 1.3.18

@dimpu
Copy link
Owner

dimpu commented Feb 24, 2017

I have sent a pull request to your please use it. Let me if it fix your issue.

@dimpu dimpu closed this as completed Feb 24, 2017
@HeinPauwelyn
Copy link
Author

Sorry but now I've got this error:

ERROR in Error encountered resolving symbol values statically. Could not resolve angular2-markdown relative to C:/***/heinpauwelyn.github.io/src/app/app.module.ts., resolving symbol AppModule in C:/***/heinpauwelyn.github.io/src/app/app.module.ts

ERROR in C:/***/heinpauwelyn.github.io/src/app/app.module.ts: Cannot find module angular2-markdown

@dimpu
Copy link
Owner

dimpu commented Feb 24, 2017

my bad it's missing typescript def file. Now I added it. I have created an another pull request for you. It's not showing "Could not resolve angular2-markdown" issue anymore. But I see some other issue in your project.

@dimpu dimpu reopened this Feb 24, 2017
@dimpu dimpu closed this as completed Feb 25, 2017
@yueming-Chen
Copy link

@dimpu HI ,I still got the same problem in my project.
that's the version what I use and set in NgModule.

  "angular2-markdown": "^1.6.0",

####ngmodule#####

import { MarkdownModule } from 'angular2-markdown';

@NgModule({
      imports:[MarkdownModule.forRoot(),]
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants