zxing-js / ngx-scanner

Angular QR code, Barcode, DataMatrix, scanner component using ZXing.
https://zxing-js.github.io/ngx-scanner/
MIT License
624 stars 224 forks source link

zxing scanner module is not working #475

Open sumant52 opened 2 years ago

sumant52 commented 2 years ago

error NG8001: 'zxing-scanner' is not a known element:

  1. If 'zxing-scanner' is an Angular component, then verify that it is part of this module.
  2. If 'zxing-scanner' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
  3. This error is displaying after installing ngx-scanner module using npm.
eqprog commented 1 year ago

Make sure you add the appropriate modules to app.module

alberthoekstra commented 1 year ago

I'm running into the same problem using these versions of the libraries inside an ionic 6 project:

    "@zxing/browser": "^0.1.1",
    "@zxing/library": "^0.19.1",
    "@zxing/ngx-scanner": "^3.6.2",

Did you manage to fix the problem @sumant52 ?

alberthoekstra commented 1 year ago

I forgot to import the module in the specific module of the page. So for example barcodescanner.module.ts instead of app.module.ts

That fixed it for me

Alessandroinfo commented 1 year ago

I still have same error with:

"dependencies": {
    "@angular/animations": "^14.2.0",
    "@angular/cdk": "^14.2.7",
    "@angular/common": "~14.2.0",
    "@angular/compiler": "~14.2.0",
    "@angular/core": "~14.2.0",
    "@angular/forms": "~14.2.0",
    "@angular/platform-browser": "~14.2.0",
    "@angular/platform-browser-dynamic": "~14.2.0",
    "@angular/router": "~14.2.0",
    "@ngxs/router-plugin": "~3.7.4",
    "@ngxs/store": "~3.7.4",
    "@rxweb/reactive-form-validators": "^2.1.3",
    "@types/chart.js": "^2.9.28",
    "@types/overlayscrollbars": "^1.9.0",
    "@zxing/browser": "^0.1.1",
    "@zxing/library": "^0.19.1",
    "@zxing/ngx-scanner": "^3.6.2",
    "async": "^3.2.4",
    "css-element-queries": "^1.2.3",
    "file-saver": "^2.0.2",
    "js-base64": "^2.5.1",
    "keycode-js": "^3.1.0",
    "lodash-es": "^4.17.21",
    "lottie-web": "^5.8.1",
    "lz-string": "^1.4.4",
    "moment": "^2.29.4",
    "rxjs": "~6.6.3",
    "tslib": "^2.0.0",
    "uuid": "^9.0.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.2.6",
    "@angular-eslint/builder": "14.2.0",
    "@angular-eslint/eslint-plugin": "14.2.0",
    "@angular-eslint/eslint-plugin-template": "14.2.0",
    "@angular-eslint/schematics": "14.2.0",
    "@angular-eslint/template-parser": "14.2.0",
    "@angular/cli": "~14.2.6",
    "@angular/compiler-cli": "~14.2.6",
    "@angular/language-service": "~14.2.6",
    "@ngxs/devtools-plugin": "^3.7.4",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/lodash-es": "^4.17.6",
    "@types/lz-string": "^1.3.34",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "5.27.1",
    "@typescript-eslint/parser": "5.27.1",
    "eslint": "^8.17.0",
    "eslint-plugin-rxjs": "^5.0.2",
    "husky": "^4.2.3",
    "jasmine-core": "^4.0.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "^5.0.0",
    "karma-jasmine-html-reporter": "^2.0.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.8.4"
  }

Error: node_modules/@zxing/ngx-scanner/lib/zxing-scanner.component.d.ts:305:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

aguantelinux commented 1 year ago

I have the same problem in Angular 13 and 14: Error: node_modules/@zxing/ngx-scanner/lib/zxing-scanner.component.d.ts:305:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 8 type arguments.

Cdvalencia commented 1 year ago

@aguantelinux Solution

MarcBollmann commented 6 months ago

@aguantelinux Solution

Worked for me summarized:

"compilerOptions": {
...
    "skipLibCheck": true,
...
}