MurhafSousli/ngx-disqus

error TS2307: Cannot find module 'ngx-disqus'

Closed this issue · 14 comments

Hi @MurhafSousli

I am trying to use this package to add disqus into my application, but I am stuck at the very first step!

After installing ngx-disqus package with command

npm install --save ngx-disqus

I tried to import it to the root module,

... 
// disqus
import { DisqusModule } from 'ngx-disqus';
...

but I got error:

ERROR in src/app/app.module.ts(17,30): error TS2307: Cannot find module 'ngx-disqus'.

My development environment is webpack based.

Any clue what's wrong?

thanks
-John

I am using following packages:

ngular CLI: 1.5.3
Node: 6.10.2
OS: darwin x64

Angular: 5.0.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.0.0-rc.2
@angular/cli: 1.5.3
@angular/material: 5.0.0-rc.2
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.36
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.3
@schematics/angular: 0.1.5
typescript: 2.4.2
webpack: 3.8.1

Hi @MurhafSousli

To help you troubleshooting, I tried several old versions, and all have the same issue with my dev environment.

But I tried package angular2-disqus, it works.

thanks

-John

@johnking It looks like a problem with your environment setup. The module works properly, here is a very simple stackblitz

Hi @MurhafSousli, I understood it might be due to my dev env, but I don't why because there are no issues with other npm packages.

Any hints?

thanks a lot.

-John

I have the same error with angular-cli@1.6.0 on ng build

@neilhem Do you mean that it works with ng serve but it gives the same error with ng build ? try to remove node_modules then install again

@MurhafSousli, for my case, I have tried this trick before but it did not work.

I am experiencing same issue.

Guys you need to reproduce the issue. otherwise, how can I help you if I can't get the error?

I have the same error with. I'am only updated from Angular 5.0.0 to 5.1.0 and I get this error.

Angular CLI: 1.6.0
Node: 8.9.2
OS: darwin x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.0
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.4.2
webpack: 3.10.0

Steps to reproduce the issue:

  1. Create a new project: ng new testapp --style=sass
  2. Update app.module.ts:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

import { DisqusModule } from "ngx-disqus";

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    DisqusModule.forRoot('any'),
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
  1. Run ng build

Result:

Date: 2017-12-10T20:09:51.251Z
Hash: f5f2c6424800751465ac
Time: 2260ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 303 bytes [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 323 bytes [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.7 kB [initial] [rendered]

**ERROR in src/app/app.module.ts(6,30): error TS2307: Cannot find module 'ngx-disqus'.**

The stackblitz example uses ngx-disqus@2.3.6. However, the npm repository only has version up to 2.3.5. This may be the cause of the problem.

@icepeng , I tried several versions, none of them worked before I submitted the issue.

I am working with Angular 4.x and downgrading to 2.2.1 solved the problem.

Hey guys, I have recompiled the package and tested it with angular-cli@1.6.1 and angular@5.1.1. it should work fine now