What steps should I take to address the issue of ERESOLVE being unable to resolve the dependency tree during an

As I delve into the world of Angular and self-teaching, I encountered an issue after importing numerous new components into my project. Upon deleting the node_modules folder and running npm install, I am faced with the following error:

npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6d0c1d1d010c40060c19190c2d5d435d435d">[email protected]</a>
npm ERR! Found: @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="90f3fffdfdfffed0a1a2bea2bea1a6">[email protected]</a>
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"~12.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^14.0.0 || ^15.0.0" from @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e182858aa1d0d5cfd1cfd3">[email protected]</a>
npm ERR! node_modules/@angular/cdk
npm ERR!   @angular/cdk@"14.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\kavis\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\kavis\AppData\Local\npm-cache\_logs\2022-06-20T10_45_13_413Z-debug-0.log

The error suggests a potential mismatch due to different versions within the dependencies. I attempted solutions like running npm install @angular/cdk@latest and ng update @angular/common, but they did not yield results. Even deleting node modules and package-lock.json did not fix the issue during npm install.

I tried forcing npm install, only to encounter another issue preventing my project from running smoothly. Any suggestions on how to address this error would be greatly appreciated.

Thank you.

Here is the content of my package.json file:

{
  "name": "appla-katta",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "node build && firebase deploy",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  
  "private": true,
  "dependencies": {
    "@angular/animations": "~12.2.0",
    "@angular/cdk": "^13.3.2",
    "@angular/common": "~12.2.0",
    "@angular/compiler": "~12.2.0",
    "@angular/core": "~12.2.0",
    "@angular/fire": "github:angular/fire",
    "@angular/flex-layout": "^13.0.0-beta.38",
    "@angular/forms": "~12.2.0",
    "@angular/material": "^13.3.2",
    "@angular/platform-browser": "~12.2.0",
    "@angular/platform-browser-dynamic": "~12.2.0",
    "@angular/router": "~12.2.0",
    "@auth0/auth0-angular": "^1.9.0",
    "@fortawesome/fontawesome-free": "^6.1.1",
    "angularfire2": "^5.4.2",
    "bootstrap": "^5.1.3",
    "cors": "^2.8.5",
    "firebase": "^7.24.0",
    "json-server": "^0.17.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.2.7",
    "@angular/cli": "~12.2.7",
    "@angular/compiler-cli": "~12.2.0",
    "@types/jasmine": "~3.8.0",
    "@types/node": "^12.11.1",
    "jasmine-core": "~3.8.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "typescript": "~4.3.5"
  }
}

I also had a package-lock.json file which I have since removed.

Answer №1

Get rid of node_modules and package-lock.json.

After that, give this a shot:

npm install --legacy-peer-deps

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

An issue occurred with lodash during the construction of /@types/lodash/common/object.d.ts at line 1188, character 142: Expected '('

Things were going smoothly, but out of nowhere my build started failing. Here are the errors that are popping up: ERROR in /node_modules/@types/lodash/common/function.d.ts (852,68): ';' expected. ERROR in /node_modules/@types/lodash/common/commo ...

Is it possible to dynamically incorporate methods into a class while specifying their types?

Can the def method be enhanced for type safety without needing to manually define interfaces? // Can we add a proper `Cat.meow(message: string)` declaration on `Cat`? const Cat = function() {} def(Cat, { meow: function(message: string) { console.log(&apo ...

Cordova: experiencing difficulties in adding android platform

After creating a new Ionic1 app with the "sidemenu" template, I encountered an error without adding any plugins or extra dependencies. The error message is as follows: npm ERR! path C:\myApp\node_modules\.staging\cordova-android-dbc95 ...

Designating a class that applies to every Angular template that can be displayed using *ngIf

I have a specific CLASS called section that I want to apply to a DIV for rendering. Surprisingly, it functions as expected. <div *ngIf="decoded; then coordinates"></div> <ng-template #coordinates> <div class="section&q ...

Using the async pipe with Angular observables

I am currently working on my first Angular application and I am facing some challenges with observables. In my HTML tag, I have the following code snippet: <mwl-calendar-month-view *ngSwitchCase="'month'" [viewDate]="v ...

The element within the array object is not properly defined and is causing error messages to be displayed

Whenever I try to use Icons[link.label] in my const, I receive the following error message: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'iconsProps'. No index sig ...

What is the method for dynamically assigning a name to ngModel?

I have the following code snippet: vmarray[]={'Code','Name','Place','City'} export class VMDetail { lstrData1:string; lstrData2:string; lstrData3:string; lstrData4:string; lstrData5:string; ...

Issues with using hooks in a remote module in Webpack 5 module federation

I am attempting to create a dynamic system at runtime using Module Federation, a feature in webpack 5. Everything seems to be working well, but I encounter a multitude of 'invalid rule of hooks' errors when I add hooks to the 'producer' ...

Updating package references from 'phantomjs' to 'phantomjs-prebuilt' in Mac OS terminal - how can this be done?

I am currently learning mean.js following a tutorial. All the necessary tools such as node.js, npm, mongodb, grunt, bower, gulp, and yeoman have been successfully installed on my system without encountering any errors. However, when I attempt to run "yo ...

Encountering an issue when trying to host an Angular project on AWS EC2 server

After deploying my Angular project on AWS EC2 in production, it seems to automatically switch to the host's AWS IP address. This is causing issues with running my service. Has anyone encountered this problem before and how did you resolve it? Any help ...

a guide to caching a TypeScript computed property

I have implemented a TypeScript getter memoization approach using a decorator and the memoizee package from npm. Here's how it looks: import { memoize } from '@app/decorators/memoize' export class MyComponent { @memoize() private stat ...

Encountered an error loading resource: server returned a 404 status code while utilizing Angular framework and deploying via GitHub Pages

Currently facing an issue with my Angular website deployment on Github Pages, receiving a console error "Failed to load resource: the server responded with a status of 404 ()" at "home: 1". This error specifically seems to be related to the app.component ...

how can I update a class of an element when the input box is disabled in angular?

Is there a way in Angular to change the class of a separate element (calendar icon button) when it detects that an input textbox is disabled? I have a disabled input type textbox and I want the class of the calendar icon button to be changed based on its d ...

Is it true that core JavaScript is not compatible with AngularJS projects?

While this may seem like a simple question to some, I have been struggling to find the answer for quite some time now. Why is it that native javascript methods like onclick do not work in my Angular 2 project? Below is a sample code snippet for reference: ...

Make sure you have the correct loader in place for dealing with this particular file type while working with Angular and LitElement

I have developed my application using angular 7. To improve productivity, I have incorporated components based on lit-element, specifically those from @lion by ING Bank. However, I encountered an error when running the application: ERROR in ./node_module ...

When trying to convert a jest test to typescript, an error message may be encountered stating: "SyntaxError: Unable to

As I delved into the clear and concise jest documentation, I managed to successfully implement this test: const { spawnSync } = require('child_process'); const ls = spawnSync('ls', ['-lh', '/usr']); const unexistent ...

A guide to submitting comments with Angular 2 using a GitHub OAuth token

I'm attempting to utilize a GitHub OAuth Token for posting comments in Angular 2. Below is the code I am using: postComment(token: string, number: Number, body: string): Promise<Comment> { let headers = new Headers() headers.append('Auth ...

The navigation links in Gatsby are not functioning properly when directing to the top level route on subpages generated with createPage

I have a question that may seem basic, but I haven't been able to find a solution by searching through the forum: I've created a 'careers' page using the pages folder (with the file name careers.js and slug /careers) and several subpag ...

Guide to Retrieving the ngControl Attribute Within a Directive on Angular 17

Attempting to implement a basic radio button group with ngModel in Angular 17. In addition, there is a directive (appTest) within which the ngControl property needs to be accessed. <div class="example-radio-group"> <mat-radio-group [(n ...

Are there more efficient methods for locating a particular item within an array based on its name?

While I know that using a loop can achieve this functionality, I am curious if there is a built-in function that can provide the same outcome as my code below: const openExerciseListModal = (index:number) =>{ let selectedValue = selectedItems[index]; it ...