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

When running ng serve shows the following error: #526

Open
mmahan13 opened this issue Jun 8, 2023 · 5 comments
Open

When running ng serve shows the following error: #526

mmahan13 opened this issue Jun 8, 2023 · 5 comments

Comments

@mmahan13
Copy link

mmahan13 commented Jun 8, 2023

The installation is done correctly, following the steps proposed in the documentation.

When running ng serve
shows the following error:

Error: node_modules/@zxing/ngx-scanner/lib/zxing-scanner.component.d.ts:305:91 - error TS2344: Type '{ autofocusEnabled: { alias: "autofocusEnabled"; required: false; }; timeBetweenScans: { alias: "timeBetweenScans"; required: false; }; delayBetweenScanSuccess: { alias: "delayBetweenScanSuccess"; required: false; }; ... 7 more ...; tryHarder: { ...; }; }' does not satisfy the constraint '{ [key: string]: string; }'.
Property '"autofocusEnabled"' is incompatible with index signature.
Type '{ alias: "autofocusEnabled"; required: false; }' is not assignable to type 'string'.

305 static ɵcmp: i0.ɵɵComponentDeclaration<ZXingScannerComponent, "zxing-scanner", never, { "autofocusEnabled": { "alias": "autofocusEnabled"; "required": false; }; "timeBetweenScans": { "alias": "timeBetweenScans"; "required": false; }; "delayBetweenScanSuccess": { "alias": "delayBetweenScanSuccess"; "required": false; }; "autostart": { "alias": "autostart"; "required": false; }; "previewFitMode": { "alias": "previewFitMode"; "required": false; }; "device": { "alias": "device"; "required": false; }; "formats": { "alias": "formats"; "required": false; }; "videoConstraints": { "alias": "videoConstraints"; "required": false; }; "torch": { "alias": "torch"; "required": false; }; "enable": { "alias": "enable"; "required": false; }; "tryHarder": { "alias": "tryHarder"; "required": false; }; }, { "autostarted": "autostarted"; "autostarting": "autostarting"; "torchCompatible": "torchCompatible"; "scanSuccess": "scanSuccess"; "scanFailure": "scanFailure"; "scanError": "scanError"; "scanComplete": "scanComplete"; "camerasFound": "camerasFound"; "camerasNotFound": "camerasNotFound"; "permissionResponse": "permissionResponse"; "hasDevices": "hasDevices"; "deviceChange": "deviceChange"; }, never, never, false, never>;

Error: node_modules/@zxing/ngx-scanner/lib/zxing-scanner.component.d.ts:305:91 - error

static ɵcmp: i0.ɵɵComponentDeclaration<ZXingScannerComponent, "zxing-scanner", never, { "autofocusEnabled": { "alias": "autofocusEnabled"; "required": false; }; "timeBetweenScans": { "alias": "timeBetweenScans"; "required": false; }; "delayBetweenScanSuccess": { "alias": "delayBetweenScanSuccess"; "required": false; }; "autostart": { "alias": "autostart"; "required": false; }; "previewFitMode": { "alias": "previewFitMode"; "required": false; }; "device": { "alias": "device"; "required": false; }; "formats": { "alias": "formats"; "required": false; }; "videoConstraints": { "alias": "videoConstraints"; "required": false; }; "torch": { "alias": "torch"; "required": false; }; "enable": { "alias": "enable"; "required": false; }; "tryHarder": { "alias": "tryHarder"; "required": false; }; }, { "autostarted": "autostarted"; "autostarting": "autostarting"; "torchCompatible": "torchCompatible"; "scanSuccess": "scanSuccess"; "scanFailure": "scanFailure"; "scanError": "scanError"; "scanComplete": "scanComplete"; "camerasFound": "camerasFound"; "camerasNotFound": "camerasNotFound"; "permissionResponse": "permissionResponse"; "hasDevices": "hasDevices"; "deviceChange": "deviceChange"; }, never, never, false, never>;
}

If you can help me with this problem since I can't find solutions.

@mmahan13
Copy link
Author

mmahan13 commented Jun 8, 2023

image

@werthdavid
Copy link
Member

Which version of angular and ngx-scanner?

@mmahan13
Copy link
Author

mmahan13 commented Jun 8, 2023

Angular CLI: 15.2.8
Node: 18.14.2
Package Manager: npm 9.5.0
OS: win32 x64

Angular: 15.2.9

ngx-scanner
"@zxing/browser": "^0.1.3",
"@zxing/library": "^0.20.0",
"@zxing/ngx-scanner": "^16.0.0",

@werthdavid
Copy link
Member

For angular 15 you need to use version 3.9.0 (define the version without ^ character in front!!)

@mmahan13
Copy link
Author

mmahan13 commented Jun 8, 2023

Ooh! I have installed the dependency
npm i @zxing/[email protected]
and it has worked correctly.
thank you!

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

2 participants