I recently updated all my projects to Angular 14, but when I tried to install a package using `npm i`, it still

The challenge at hand

I encountered an issue with my two Angular projects. The first project serves as a library utilized by the second project. I recently upgraded both projects to Angular 14 following this guide.

However, after running an npm i on the second project, I was surprised to see that it still required Angular 3 for the library, which left me puzzled and unable to resolve the discrepancy.

Here is the error message displayed when executing npm i in the second project:

While resolving: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="50333f3d203f3e353e247d333f3f3b39352310617e61607e60">[email protected]</a>
Found: @angular/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6704080a0a080927565349544957">[email protected]</a>
node_modules/@angular/common
  @angular/common@"^14.3.0" from the root project

Could not resolve dependency:
peer @angular/common@"~13.1.2" from @xxx/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7f13161d0d1e0d063f4e514e4b47514f520d1c514c4b4c4946">[email protected]</a>
node_modules/@xxx/library
  @xxx/library@"1.148.0-rc.34369" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

This section highlights the configuration within the package.json of the library:

{
  "name": "xxx-library",
  "version": "1.148.0",
    ... more content here
}

Similarly, below are the details from the package.json of the second project:

{
  "name": "component-cookies",
  "version": "1.10.0",
   ... various scripts and dependencies listed
}

The strategies employed

To tackle this dilemma, I experimented with several solutions:

  1. Deleting the package-lock.json file from both projects before running npm i again.
  2. Removing the package-lock.json, node-modules, and .angular/cache directories prior to re-executing npm i.
  3. Erasing the local project entirely and reinstalling everything from the remote branch afresh.
  4. Upgrading the Node version locally from 16 to 18.
  5. Scouring through the library's package-lock.json to identify any dependencies linked to Angular 13.

Note:

Upon inspecting the library's package-lock.json, I noticed only one dependency pointing towards Angular 13:

...
    some relevant information from package-lock.json
...

Despite reviewing additional resources confirming no issues, the library continues to request Angular 13 upon installation in the second project, raising confusion regarding the matter due to the absence of other Angular 13 references in the package-lock file.

Recent developments

Ran npm ls @angular/common resulting in:

<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="555b5bb54e51536b49505f48583d52535148745746495e7646540b09544e51">[email protected]</a>
Some directory paths and Angular versions listed here

Answer №1

Upon further investigation, I found that the projects contained nested projects, each with its own package.json file. Unfortunately, when using the ng update angular command, it only updated the Angular version in the first package.json file. This meant manually changing the Angular version in all of the nested project's package.json files.

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

Creating a new endpoint within the Angular2 framework using typescript

I am brand new to Angular2 and I would like to streamline my API endpoints by creating a single class that can be injected into all of my services. What is the most optimal approach for achieving this in Angular2? Should I define an @Injectable class sim ...

What is the best way to implement material theme colors into my Angular2 CSS?

Suppose I want to utilize the mat-primary color as a background for a div using a CSS/SASS class, how should I reference it? My initial thought was: @import '~@angular/material/prebuilt-themes/deeppurple-amber.css'; .my-class{ background-colo ...

What are some effective methods for handling error objects in REST API services?

Encountered an error object: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost' (using password: YES) Type of (err): Object Now, I am looking to pass this object to another web service (REST API) What content ty ...

Having trouble finishing the installation of expo-cli with npm install -g?

I've been attempting to install expo-cli using nvm, but it seems to get stuck at a certain point during the installation process. Despite trying different node versions and removing potential permission issues that could be blocking the installation, ...

Angular 5 using AngularFire for Seamless Firebase Login Experience

Utilizing AngularFire2 in combination with Firebase and Angular 5, I have successfully implemented a login system. However, upon refreshing the page, a slight flicker occurs due to the delay in loading JavaScript. This issue is unfamiliar to me as I'm ...

How to effectively close an Angular material dialog with active ngForm?

Is it possible to close a dialog when using ngForm? I have multiple dialogs that appear before the final one, and I know how to get data using [mat-dialog-close]="true" along with MAT_DIALOG_DATA. However, in this last dialog, I am using ngForm t ...

The Angular project was functioning properly when tested locally, but encountered an error in the Quill Editor during the building process

I have encountered an issue when deploying my Angular 8 + Quill project. Everything works fine locally with 'ng serve', but upon deployment, I am facing the following error. Despite trying various solutions like updating Angular or deleting &apos ...

Steps to resolve the error "unable to install publish-please globally" that occurs while attempting to install `npm install firebase-tools -g`:

Recently, a problem has arisen on my CI server. Whenever I attempt to deploy my codes, I consistently run into an issue with running npm install firebase-tools. Lately, this error has been preventing the deployment process from proceeding smoothly. To rep ...

Adding a custom role in Angular TypeScript in Microsoft AppInsights is a straightforward process that can provide valuable

I have an angular project where I am looking to incorporate AppInsight with custom telemetry (role). The project is built in Angular using TypeScript, and I successfully integrated appinsights by following this tutorial. However, when attempting to add cus ...

Encountered an error stating 'name' property is undefined while using @input in Angular 2

Everything seems to be set up correctly, but I'm encountering an error in the browser console that says "Cannot read property 'name' of undefined": This is how my media.component.ts file is structured: import { Component, Input } from &apo ...

Error! There seems to be a missing start script for Vue.js in the npm ERR

After trying to install Vuetable with the command npm install vuetable-2@next --save, I encountered the following error message: npm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR! x\AppData\Roaming& ...

Acquire Base64 Representation from an HTTP Call

I'm looking for a solution to convert an image from a URL into a base64 string using two functions: getImageAsBlob and toBase64. The former uses HttpClient to fetch the image as a Blob, while the latter converts the retrieved Blob into a base64 string ...

Problem installing npm in Laravel framework

Help needed with Laravel documentation. I am following the steps but encountering an error when running npm install. The error message is: https://i.stack.imgur.com/9ChxP.png PS C:\xampp\htdocs\laravel-authentication> npm install npm ...

Refresh a Google chart without having to reload the entire page

I currently have a button that allows me to refresh the data on my page in case there is new data available through an API. Although this button successfully refreshes my datatable, it does not redraw the Google charts I have integrated into my project usi ...

Disabling the range selection in the mat-date-range-picker when the date is disabled

I am trying to use the mat-date-range-picker feature to prevent users from selecting a date range that includes disabled dates. In the provided example (available at this stackblitz url: https://stackblitz.com/edit/angular-rbeehp?file=src%2Fapp%2Fdate-ran ...

Utilize Angular to inject an input from a component directly into the header of my application

I am looking to customize my Pages by injecting various components from different Pages/Components into the header. Specifically, I want to inject an Input search field from my content-component into the header Component. I initially attempted to use ng-Co ...

Collision Detection in Kendo UI Menu

When working with TypeScript, it ensures that the parameters are of the correct type. For Kendo's menu, in order to disable the popupCollision property, you need to set it to false. However, this property actually accepts a string as its value, so if ...

Is there a way to obtain a unique response in TestCafe RequestMock?

With Testcafe, I have the capability to simulate the response of a request successfully. I am interested in setting up a caching system for all GET/Ajax requests. The current setup functions properly when the URL is already cached, but it fails to prov ...

Getting exported members through Typescript Compiler API can be achieved by following these steps:

I am currently working on a project hosted at https://github.com/GooGee/Code-Builder This particular file is being loaded by the Typescript Compiler API: import * as fs from 'fs' Below is a snippet of my code: function getExportList(node: t ...

Error encountered: NPM ERR Code E401 - Authentication failed, authorization required with Bearer token

After downloading a NodeJS application from GitHub, I encountered an error when trying to execute npm install. npm ERR! code E401 npm ERR! Unable to authenticate, need: Bearer authorization_uri=https://login.windows.net/c1156c2f-a3bb-4fc4-ac07-3eab96da ...