The file node_modules/angular2-qrscanner/angular2-qrscanner.d.ts has been detected as version 4, while version 3 was expected. Resolving symbol

We're encountering a Metadata error that is causing obstacles in our deployment process. This issue is preventing the execution of ng build. Below, you will find the configuration details along with the complete error trace.

ERROR in Error: Metadata version mismatch for module <Angular4.3-AppPath>/node_modules/angular2-qrscanner/angular2-qrscanner.d.ts, found version 4, expected 3, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/modules/manage/device/device.module.ts, resolving symbol <Module_Name>in <Angular4.3-AppPath>/src/app/<Module_Path>.ts
at syntaxError (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:1725:34)
at simplifyInContext (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24953:23)
at StaticReflector.simplify (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24965:13)
at StaticReflector.annotations (<Angular4.3-AppPath>\node_modules@angular\compiler\bundles\compiler.umd.js:24395:41)
at _getNgModuleMetadata (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:109:26)
at <Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:129:27
at Array.reduce ()
at _extractLazyRoutesFromStaticModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (<Angular4.3-AppPath>\node_modules@angular\compiler-cli\src\ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (<Angular4.3-AppPath>\node_modules@ngtools\webpack\src\plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (<Angular4.3-AppPath>\node_modules@ngtools\webpack\src\plugin.js:495:24)
at
at process._tickCallback (internal/process/next_tick.js:188:7)

webpack: Compilation failed.

Settings: angular2-qrscanner version: 1.0.7 Angular CLI: 1.5.0 Node: 8.10.0 OS: win32 x64 Angular: 4.3.2 ... common, compiler, compiler-cli, core, forms, http ... platform-browser, platform-browser-dynamic, router @angular/animations: 4.4.0-RC.0 @angular/cdk: 2.0.0-beta.10 @angular/cli: 1.5.0 @angular/flex-layout: 2.0.0-beta.8 @angular/material: 2.0.0-beta.10 @angular-devkit/build-optimizer: 0.0.33 @angular-devkit/core: 0.0.20 @angular-devkit/schematics: 0.0.35 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.8.0 @schematics/angular: 0.1.3 typescript: 2.6.1 webpack: 3.8.1

Answer №1

Successfully fixed the issue on localhost:4200 by deprecating the package to [email protected]. Everything is now working perfectly!

However, when hosting it as an Azure WebApp, the camera does not load and an error message appears in the Chrome console:

The media was refused to load from 'blob:/5c07044f-447c-45a9-979e-458d5e955f8f' due to a Content Security Policy violation with directive "default-src 'unsafe-inline' data: https:". It seems that the 'media-src' was not explicitly set, so the 'default-src' is being used.

I have found a solution for this issue: Edge and IE browsers do not show this error, but the camera doesn't scan. I am considering switching to a different QR scanner or sticking with "angular2-qrscanner". I will need to make a decision soon.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to include the `bin/` folders within the `node_modules/` directory when adding files to T

I currently have a Build server running Team Foundation behind a firewall, and I'm looking to include the node_modules/ directory (which is utilized by both a Browserify client app and Node server app) in my project check-in. This will ensure that all ...

How to refresh a specific component or page in Angular without causing the entire page to reload

Is there a way to make the selected file visible without having to reload the entire page? I want to find a cleaner method for displaying the uploaded document. public onFileSelected(event): void { console.log(this.fileId) const file = event.targe ...

Executing the command "npm run script" produces no results

I find it strange that I have the following scripts in my package.json file: "scripts": { "lint": "./node_modules/tslint/bin/tslint src/js/**/*", "lint:fix": "./node_modules/tslint/bin/tslint src/js/**/* --fix" }, When I execute npm run lint, I do ...

What is the best practice for making a gRPC call within a Typescript Vue.Js component?

Upon reviewing the grpc documentation, I discovered that proto files can be used to generate Node (Javascript), Typescript with the assistance of grpc_tools_node_protoc_ts, and grpc-web. Given that performance is not a critical factor in my particular situ ...

How can a TypeScript function be used to retrieve a string (or JSON object)?

When attempting to retrieve data from a web API using TypeScript and return the JSON object, encountering an error has left me puzzled. Inside my function, I can successfully display the fetched data on the console, but when I try to return it with return ...

Unique loading animations are assigned to each individual page within the Next.js framework

Is there a way to have unique loading animations for each of my website pages during the loading process? How can I achieve this? I've attempted to put the loading component on the page component directly, but it doesn't seem to work: //Page com ...

Define the state of an object using Parent and Children classes following the application of a filter

Within Angular 8, I am dealing with an Observable: let parents: Observable<Parent[]>; The classes Parent and Child are defined as follows: class Parent { id: number; name: string; children: Child[]; } class Child { id: number; name: str ...

Execute the CountUp function when the element becomes visible

Currently, I am implementing the following library: https://github.com/inorganik/ngx-countUp Is there a way to activate the counting animation only when the section of numbers is reached? In other words, can the count be triggered (<h1 [countUp]="345 ...

Enhancing TypeScript Data Objects

I'm looking to expand a data object in TypeScript by introducing new fields. Although I know it's a common practice in JavaScript, I'm struggling to get it to compile without making bar optional in the provided snippet. I am interested in f ...

I'm interested in learning how to implement dynamic routes in Nexy.js using TypeScript. How can I

I have a folder structure set up like this: https://i.stack.imgur.com/qhnaP.png [postId].ts import { useRouter } from 'next/router' const Post = () => { const router = useRouter() const { pid } = router.query return <p>Post: {p ...

What is the best way to assign the result of a promise to a variable?

My code includes an async function that retrieves a value async fetchUserName(environment: string, itemName: string, authToken: string): Promise<any> { let result = await this.obtainDeviceName(environment, itemName, authToken); return ...

Adjusting the value of a mat-option depending on a condition in *ngIf

When working with my mat-option, I have two different sets of values to choose from: tempTime: TempOptions[] = [ { value: 100, viewValue: '100 points' }, { value: 200, viewValue: '200 points' } ]; tempTimesHighNumber: TempOpt ...

Displaying nested objects within an object using React

Behold this interesting item: const [object, setObject] = useState ({ item1: "Greetings, World!", item2: "Salutations!", }); I aim to retrieve all the children from it. I have a snippet of code here, but for some reason, i ...

Error in Template Syntax for External Pug Templates: Component template must have a root element, not just plain text

I've been struggling to make Pug templates work with Vue class-based components using a separate file for the pug template. The documentation suggests that adding this code should do the trick: // webpack.config.js -> module.rules { test: /&bsol ...

The Sanity npm package encounters a type error during the build process

Recently, I encountered an issue with my Next.js blog using next-sanity. After updating all npm packages, I found that running npm run build resulted in a type error within one of the dependencies: ./node_modules/@sanity/types/lib/dts/src/index.d.ts:756:3 ...

Unable to locate a type definition file for module 'vue-xxx'

I keep encountering an error whenever I attempt to add a 3rd party Vue.js library to my project: Could not find a declaration file for module 'vue-xxx' Libraries like 'vue-treeselect', 'vue-select', and 'vue-multiselect ...

Set the default value for a form control in a select dropdown using Angular

I've been struggling to figure out how to mark an option as selected in my select element, but I haven't had any luck. I've tried multiple solutions from the internet, but none of them seem to be working for me. Does anyone out there have ...

What could be causing the images to not display on my HTML page?

My program is designed to display an image based on the result of the random function. Here is my HTML: <div> <h2>Player 0:</h2> <div id="MainPlayer0"></div> </div> Next, in my TypeScript fi ...

Enhancing User Experience through 'Remember Me' Feature in Angular App

I need assistance with adding the Remember Me functionality to a login form in an Angular application. Could someone please provide guidance on how to achieve this? Your help would be highly appreciated! Thank you in advance! Below is my login.ts file: ngO ...

Is it possible to set up multiple registries within a single package.json configuration?

Is it possible to define two different registries within the publishConfig section of the package.json file? The scenario is that we want to publish the artifact to two different locations depending on its purpose. For SNAPSHOT versions, we would like to ...