Repository navigation
ng update not resolving the correct NPM package when using npm:<name> syntax as version range #25224
Description
Command
update
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
I searched through the issues and I did found some related issues but they weren't exactly the same:
- ng add doesn't use the proper yarn registry. #23448
- "ng update" doesn't support private repos such as FontAwesome 5 Pro #10624
Feel free to close this issue if you fill like it's a duplicate of another one.
I wanted to update my angular project to the latest version and I executed the command:
ng update @angular/cli @angular/coreIn my project I have as a development dependency @types/web (TypeScript DOM declaration files) because I have private libraries that use my applications and I like to make sure that all my projects use the same version of declaration files and also I like to decouple the TypeScript compiler version from the declaration files version.
The dependecy in the package.json looks like the following:
"@typescript/lib-dom": "npm:@types/web@^0.0.99"
You can see that the package hosted in NPM registry is @types/web but the name of the dependency store in node_modules is @typescript/lib-dom.
It's this way because TypeScript will search in /node_modules/@typescript/lib-dom to know if the declaration files have been installed independently. If the folder is not present, it will use the declaration files that come with the TypeScript compiler (/node_modules/typescript/lib/lib.dom.d.ts).
When I execute the ng update command, I get the following error:
✔ Packages successfully installed.
Using package manager: npm
Collecting installed dependencies...
Found 16 dependencies.
Fetching dependency metadata from registry...
✖ Migration failed: 404 Not Found - GET https://registry.npmjs.org/@typescript%2flib-dom - Not found
See ".../angular-errors.log" for further details.Basically, the Angular CLI is trying to fetch @typescript/lib-dom but this is not the name of the package, the correct name to fetch is @types/web.
Minimal Reproduction
I have created the following repository that reproduces the issue.
You don't need to clone it, you can follow the steps explained in the README.md:
https://github.com/jordimarimon/angular-cli-update-issue
Exception or Error
[error] HttpErrorGeneral: 404 Not Found - GET https://registry.npmjs.org/@typescript%2flib-dom - Not found
at /tmp/angular-cli-packages-Fv6UlW/node_modules/npm-registry-fetch/lib/check-response.js:95:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RegistryFetcher.packument (/tmp/angular-cli-packages-Fv6UlW/node_modules/pacote/lib/registry.js:87:19)
at async Promise.all (index 3)
at async /tmp/angular-cli-packages-Fv6UlW/node_modules/@angular/cli/src/commands/update/schematic/index.js:671:36
at async callRuleAsync (/tmp/angular-cli-packages-Fv6UlW/node_modules/@angular-devkit/schematics/src/rules/call.js:77:18)
Your Environment
Angular CLI: 15.2.8
Node: 18.12.1
Package Manager: npm 9.5.1
OS: linux x64
Angular: 15.2.9
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1502.8
@angular-devkit/build-angular 15.2.8
@angular-devkit/core 15.2.8
@angular-devkit/schematics 15.2.8
@angular/cli 15.2.8
@schematics/angular 15.2.8
rxjs 7.8.1
typescript 4.9.5
Anything else relevant?
No response
Activity
BIG293 commentedon Mar 27, 2024
same issue
m96-chan commentedon Aug 26, 2024
same issue.
CCBet commentedon Sep 4, 2024
@alan-agius4 , is this issue going to be taken care of soon?
alan-agius4 commentedon Sep 4, 2024
There is not ETA for a fix for this, however PRs are most certainly welcome.
Christoph142 commentedon Oct 24, 2024
I just hit the same issue. Furthermore, I also tried adding an explicit override for the package along the lines of
"overrides": { "@typescript/lib-dom": { "@types/web" : "^0.0.99" } }(different package for me). No luck either.
angular-automatic-lock-bot commentedon Aug 21, 2026
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.