Having trouble resolving the npm ERR with @angular-devkit/[email protected]? Found the solution to fixing it by checking out @angular/[email protected] instead

When I try to update the local Angular CLI version, I keep encountering an error with this command:

npm uninstall --save-dev angular-cli. (following instructions from this source)

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9af8eff3f6feb7fbf4fdeff6fbe8daabafb4aab4ae">[email protected]</a>
npm ERR! Found: @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b6d5d9dbc6dffaf1c2e0feefd2faa1efe0fdffeb">[email protected]</a>
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   dev @angular/compiler-cli@"~12.2.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^15.0.0" from @angular-devkit/{" "}
npm ERR! node_modules/@angular-devkit/build-angular
...">

Similarly, I face an error when running npm install:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4e2c3b27222a632f20293b222f3c0e7f7b607e607a">[email protected]</a>
npm ERR! Found: @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="61eeedfdcecccbfbafa5fafea2ededff">$[email protected]</a>
npm ERR! node_modules/@angular/compiler-cli
npm ERR! ...</questionbody>
<exquestionbody>
<div class="question">
                
<p>I am trying to update my local Angular CLI version, but whenever I use the specified command, I keep receiving the following error:</p>
<p>npm uninstall --save-dev angular-cli. (trying to follow steps provided in <a href="https://www.angularjswiki.com/angular/update-angular-cli-version-ng-update-to-latest-6-7-versions/" rel="noreferrer">this guide</a>)</p>
<pre><code>npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular-devkit/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9af8eff3f6feb7fbf4fdeff6fbe8daabafb4aab4ae">[email protected]</a>
npm ERR! Found: @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b6d5d9dbc6dfdaf3d0dddcd5dee6caacc9cdc2ddded85<br /><br />Written by: xyz</p>
    </div>
</exquestionbody>
<answer1>
<div class="answer accepted" i="75012104" l="4.0" c="1672861151" v="6" a="THVpZ2kgV29vZGhvdXNl" ai="15315878">
<p>Try the following commands</p>
<p>npm install --force</p>
<p>ng update @angular/core@15 @angular/cli@15 --force</p>
<p>Also enter this command so you wont have to use --force again. This should resolve the dependency conflicts</p>
<p>npm config set legacy-peer-deps true</p>
    </div>
</answer1>
<answer2>
<div class="answer" i="75012699" l="4.0" c="1672867394" v="-1" a="a2Fzb3BlIGpvaG5zb24=" ai="14024690">
<p>You have 2 options:</p>
<p>Satisfy the @angular-devkit/build-angular peer dependency requirement FIRST by installing</p>
<pre><code>npm i @angular/compiler-cli@^15.0.0

then run your command again

Or let npm resolve it using legacy peer deps resolution:

npm uninstall -D angular-cli --legacy-peer-deps

Answer №1

Give these commands a shot

npm install --fixed

ng update @angular/core@15 @angular/cli@15 --fixed

Additionally, run this command to avoid using --force in the future. It should help with any dependency conflicts.

npm config set legacy-peer-deps true

Answer №2

You are faced with two possible choices:

Firstly, you can address the @angular-devkit/build-angular peer dependency requirement by initially installing

npm i @angular/compiler-cli@^15.0.0

and then proceed to execute your command again.

Alternatively, you can allow npm to handle it by making use of legacy peer dependencies resolution:

npm uninstall -D angular-cli --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

Restoring NPM packages within Visual Studio is always done in the System32 directory

Every time I attempt to execute the Restore Packages command by right-clicking on the package.json file, the output below is displayed: PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External ...

What is the method for reaching the electron process from a different npm process?

Recently, I developed a script that sets up a TCP server to listen for incoming requests and triggers a Windows notification upon receiving one. Here's the code snippet: const notifier = require('node-notifier'); const path = require('p ...

Making changes to a single formControl in angular6 will cause the other formControl to be updated as

I have two select menus in my user interface with the same options. When I select an option in one menu, I want the other menu to display the same option, and vice versa. Currently, I am using the valueChanges method on the first formControl to update the ...

How can we include additional types for external npm packages in a React TypeScript project?

Recently, I encountered an issue while using the react-microsoft-login package from npm. I included a button in the children property and received a typescript error stating that "property 'children' does not exist on type 'intrinsicattribut ...

Modifying state within reducers is not allowed

Encountered the following error while using @ngrx/store: index.js?4b23:19 State mutation is prohibited inside of reducers. (anonymous) @ index.js?4b23:19 (anonymous) @ index.ts:54 rootReducer @ index.ts:70 _initialStateFactory @ ng2.ts?2a33:24 AppModule ...

"The ion-label in Ionic2 is cutting off some of the text and not displaying it

I'm currently facing an issue with ion-label inside ion-item. The description is not properly displaying and instead, it shows dot-dot.. ..I need the entire text to be visible. Is there any solution available? <ion-card *ngFor="let product of prod ...

Sorting and paginating the PrimeNG data table causes the webpage to automatically scroll to the top

Currently utilizing PrimeNG Datatable with pagination enabled. When attempting to sort a column or click on pagination buttons, the page automatically scrolls to the top. This behavior is due to the default href="#" in Primeng anchor tags. For example: & ...

The JSX component is successfully rendered on the Nuxt dev server, but encounters issues on the production version

I'm facing an issue with my Nuxt app component that utilizes JSX. Everything works fine locally when I use `npm run dev`, but the rendered output is incorrect after executing `npm run build`. Below is the code for the component: <script> import ...

Navigate to the previous page

What is the best way to navigate back to the last page in Angular 2? Can it be done like this? this._router.navigate(LASTPAGE); For instance, if page C includes a Go Back button, From Page A to Page C, clicking it will take you back to Page A. Fro ...

Retrieve the current state of the toggle component by extracting its value from the HTML

I have a unique component that consists of a special switch and several other elements: <mat-slide-toggle (change)="toggle($event)" [checked]="false" attX="test"> ... </mat-slide-toggle> <p> ... </p> F ...

Executing a custom node module in script commands specified in package.json file

I created a node package called my-module which functions properly. When I add this module to a larger project, I would like it to be executed through the packege.json file. Here is how it currently works: "scripts": { "myModule" : "node ./node_modul ...

Error encountered during npm installation - EPERM: Operation not allowed

Today's challenge began when attempting to run the angular4 project and encountering this error: npm install eperm operation not permitted. In an effort to resolve it, I decided to delete the node modules folder and try again. However, upon running np ...

Having trouble connecting react-native-version-number

I'm having trouble installing react-native-version-number. The tutorial on this page instructs to run the following command after installation: react-native link react-native-version-number However, when I do this, an error message pops up saying: ...

Is it possible to pass multiple parameters in Angular by utilizing the click() function?

Is there a method for passing parameters with click() in Angular? <a asp-action="CreateSales" (click)="CreateSales(productname='pa', price='16.5')">Some Text</a> I am still learning Angular and would appreciat ...

Angular 2+ seems to be failing to detect and update changes in variables within the template

I have a component that includes rendering the user's name from the profile object. The corresponding part of the template looks like this: <button mat-button [matMenuTriggerFor]="userMenu" *ngIf="isAuthenticated()"> {{profile?.name} ...

Inheriting Angular components: How can the life cycle hooks of a parent component be triggered?

So I'm working with BaseComponent and a number of child components that extend it: export class Child1Component extends BaseComponent implements OnInit, AfterViewInit In the case of Child1Component, there is no explicit call to super.ngAfterViewInit ...

Obtain an array of column values within an array of objects using Angular 12

I am working on an Angular 12 project and need to fetch all data from the artisticBehaviour column in the Users table, excluding NULL values or duplicates e.g. Actor, Actor. Below is the TypeScript function that retrieves all users from the Users table. a ...

Convert the existing jQuery function to Angular 9 syntax

I have just started learning Angular and am finding it challenging to rewrite a jQuery code that I use for loading the "classycountdown" script. Below is the jQuery function that I need to convert: $(document).ready(function() { var remainingSec = $(& ...

Having difficulty in dynamically loading an image from an API's URL in Angular

In the title, I mentioned that I am utilizing a free API to display cryptocurrency news for my practice project. Everything seems to be working fine except for displaying the images in card view. I will share my code here, so if you have any suggestions on ...

Does the presence of a package-lock.json file in a node module override or ignore the parent package-lock.json file?

Imagine you have a repository that contains various peer development dependencies. This particular repository serves as a standalone eslint configuration, similar to airbnb. If you were to utilize this repository in another project as a node module by imp ...