ngx-qrcode: Error message still referencing ngx-qrcode2

This might be related to #10.

I’m getting the following error message when ng serve:

ERROR in ../src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve 'ngx-qrcode2' in 'D:\path_to_project\src\app'

As suggested in a comment from 2017 in that issue, using ngx-qrcode2 directly, works.

Versions:

Usage (just adding the relevant lines):

  • package.json
  "dependencies": {
    "@techiediaries/ngx-qrcode": "^9.0.0"
  }
  • app.module.ts
import { NgxQRCodeModule } from '@techiediaries/ngx-qrcode';

@NgModule({
  imports: [
    NgxQRCodeModule,
  ]
})
  • home.component.ts
export class HomeComponent implements OnInit {
  elementType = 'url';
  exampleLink = '';

  constructor(private toastr: ToastrService,private authService: AuthService) { }

  ngOnInit() {
    this.exampleLink = 'http://localhost:4200/example/qrc?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJsb2dnZWRJbkFzIjoiYWRtaW4iLCJpYXQiOjE0MjI3Nzk2Mzh9.gzSraSYS8EXBxLN_oWnFSRgCzcmJmMjLiuyu5CSpyHI';
  }
}
  • home.component.html
<ngx-qrcode [elementType]="elementType" [value]="exampleLink"></ngx-qrcode>

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15

Most upvoted comments

@bergamin we are working to solve this problem ASAP.

Closed by #63

As the original issue, it’s solved we close this issue. To solve the Angular 6 compatibility open a new issue, please.

@rafa-as, it worked for me. Waiting for next issues on my project to try it out on a real environment

@anakin59490 I don’t test the new version with Angular 6 yet. But I’m sure that doesn’t work as @bergamin said because the version is not compatible.

Please, can you open a new issue to check the compatibility and create documentation about this?

@bergamin you can check in the readme the solution about your issue: https://github.com/techiediaries/ngx-qrcode#troubleshoots

@anakin59490, there you go:

package.json
{
  "name": "xxxxxx",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.4",
    "@angular/cdk": "^8.2.3",
    "@angular/common": "~8.2.4",
    "@angular/compiler": "~8.2.4",
    "@angular/core": "~8.2.4",
    "@angular/forms": "~8.2.4",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "~8.2.4",
    "@angular/platform-browser-dynamic": "~8.2.4",
    "@angular/router": "~8.2.4",
    "@ngrx/effects": "^8.5.2",
    "@ngrx/store": "^8.5.1",
    "@ngrx/store-devtools": "^9.0.0",
    "@zxing/ngx-scanner": "^3.0.0",
    "date-fns": "^2.7.0",
    "ngx-cookie-service": "^3.0.4",
    "@techiediaries/ngx-qrcode": "^9.1.0",
    "ngx-toastr": "^11.3.0",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.3",
    "@angular/cli": "~8.3.3",
    "@angular/compiler-cli": "~8.2.4",
    "@angular/language-service": "~8.2.4",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }
}

I’m on Angular 8. That could be the issue…

Also, I had a problem when trying the lib out that I don’t quite remember what it was about. Not sure if your case, but I solved it by adding this to index.html:

  <script>
    if (global === undefined) {
      var global = window;
    }
  </script>

With previous version (9.0.0), I had same error as @bergamin : Error: Can’t resolve ‘ngx-qrcode2’

I have just changed version : 9.1.0 and now I have this mesage (cf picture)

@rafa-as thanks for updating us on this issue

@anakin59490, no. Except for adding the dependency directly the way I mentioned (which is deprecated), I have not.

They say they are working on a similar problem right now (see #10 last comments), but I expected they would at least have commented something here by now