Skip to content

ng update ignores project .npmrc registry #27163

Closed

Description

@samwootton

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 have a project level .npmrc with
registry=https://registry.npmjs.org/
and a user level .npmrc with
registry=https://example-company-private-repo.org/

As described here https://docs.npmjs.com/cli/v10/configuring-npm/npmrc project level config should override user level config. The output of npm config:

; "user" config from /Users/sam.wootton/.npmrc
; registry = "https://example-company-private-repo.org/" ; overridden by project
; "project" config from /Users/sam.wootton/devspace/personal/ngstuff/myproject/.npmrc
registry = "https://registry.npmjs.org/" 
; "cli" config from command line options

Minimal Reproduction

ng update (with different registry in .npmrc at the user and project level).
I've removed node_modules (to ensure no packages from the user level registry)

Exception or Error

Running ng update, the user level registry is used and the project level one is ignored:

ng update @angular/core@16 @angular/cli@17                                       
The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned 16.2.12 to perform the update.
npm ERR! code ENOTFOUND
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR! network request to https://company-private-repo.org/@angular%2fcli failed, reason: getaddrinfo ENOTFOUND company-private-repo.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'


### Your Environment

Angular CLI: 15.2.10
Node: 16.15.0
Package Manager: npm 8.5.5
OS: darwin arm64

Angular:
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1502.10 (cli-only)
@angular-devkit/build-angular
@angular-devkit/core 15.2.10 (cli-only)
@angular-devkit/schematics 15.2.10 (cli-only)
@angular/cli 15.2.10 (cli-only)
@schematics/angular 15.2.10 (cli-only)
rxjs 6.6.7 (cli-only)
typescript



### Anything else relevant?

_No response_

Activity

  1. alan-agius4 commented on Mar 4, 2024

    @alan-agius4
    Collaborator

    Can you please run the update command with the --verbose option and provide the output? Thanks.

  2. samwootton commented on Mar 5, 2024

    @samwootton
    Author

    I was attempting to recreate from scratch, unfortunately have the same issue with
    ng new --create-application=false
    It hangs if I have this in my ~/.npmrc
    registry=https://example-company-private-repo.org/
    But works if I have
    registry=https://registry.npmjs.org
    In both examples, the project directory .npmrc has
    registry=https://registry.npmjs.org
    I can't run ng new with verbose, doesn't seem to be an option
    https://angular.io/cli/new
    Thanks, Sam

  3. alan-agius4 commented on Mar 5, 2024

    @alan-agius4
    Collaborator

    @samwootton, I looks like you are reporting a a slightly different issue.

  4. samwootton commented on Mar 5, 2024

    @samwootton
    Author

    @alan-agius4 same issue, just with "new" instead of "update".
    I guess as the initial directory just has .nmprc (and there is no ng workspace / project), that .npmrc is ignored and the ~/.npmrc is used. There's no way to specify an .npmrc or registry when running "ng new"?

  5. samwootton commented on Mar 9, 2024

    @samwootton
    Author

    @alan-agius4 I ran with --verbose, you can see from the log here, the ~/.npmrc is being chose (line 11).
    You can see I use nvm too. Here's the log output:

    0 verbose cli [
    0 verbose cli   '/Users/sam.wootton/.nvm/versions/node/v16.15.0/bin/node',
    0 verbose cli   '/Users/sam.wootton/.nvm/versions/node/v16.15.0/bin/npm',
    0 verbose cli   'install',
    0 verbose cli   '@angular/cli@17.2.3',
    0 verbose cli   '--prefix=/private/var/folders/qw/95f4vfgn1wb8gz402xpx0n6w0000gp/T/angular-cli-packages-StDlIR',
    0 verbose cli   '--no-package-lock'
    0 verbose cli ]
    1 info using npm@8.5.5
    2 info using node@v16.15.0
    3 timing npm:load:whichnode Completed in 0ms
    4 timing config:load:defaults Completed in 1ms
    5 timing config:load:file:/Users/sam.wootton/.nvm/versions/node/v16.15.0/lib/node_modules/npm/npmrc Completed in 1ms
    6 timing config:load:builtin Completed in 1ms
    7 timing config:load:cli Completed in 1ms
    8 timing config:load:env Completed in 0ms
    9 timing config:load:file:/private/var/folders/qw/95f4vfgn1wb8gz402xpx0n6w0000gp/T/angular-cli-packages-StDlIR/.npmrc Completed in 0ms
    10 timing config:load:project Completed in 0ms
    11 timing config:load:file:/Users/sam.wootton/.npmrc Completed in 2ms
    12 timing config:load:user Completed in 2ms
    13 timing config:load:file:/private/var/folders/qw/95f4vfgn1wb8gz402xpx0n6w0000gp/T/angular-cli-packages-StDlIR/etc/npmrc Completed in 0ms
    14 timing config:load:global Completed in 0ms
    15 timing config:load:validate Completed in 1ms
    

    Here is the console output:

    sam.wootton@L7S9LXD3-MC1 tyt % ng update @angular/core@17 @angular/cli@17 --verbose
    Locating potential npmrc files:
    Trying '/Users/sam.wootton/.npmrc'...found.
    Trying '/Users/sam.wootton/devspace/personal/tyt/.npmrc'...found.
    The installed Angular CLI version is outdated.
    Installing a temporary Angular CLI versioned 17.2.3 to perform the update.
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: '@angular/cli@17.2.3',
    npm WARN EBADENGINE   required: {
    npm WARN EBADENGINE     node: '^18.13.0 || >=20.9.0',
    npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6 || >=8.0.0',
    npm WARN EBADENGINE     yarn: '>= 1.13.0'
    npm WARN EBADENGINE   },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: '@angular-devkit/architect@0.1702.3',
    npm WARN EBADENGINE   required: {
    npm WARN EBADENGINE     node: '^18.13.0 || >=20.9.0',
    npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6 || >=8.0.0',
    npm WARN EBADENGINE     yarn: '>= 1.13.0'
    npm WARN EBADENGINE   },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: '@angular-devkit/core@17.2.3',
    npm WARN EBADENGINE   required: {
    npm WARN EBADENGINE     node: '^18.13.0 || >=20.9.0',
    npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6 || >=8.0.0',
    npm WARN EBADENGINE     yarn: '>= 1.13.0'
    npm WARN EBADENGINE   },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: '@angular-devkit/schematics@17.2.3',
    npm WARN EBADENGINE   required: {
    npm WARN EBADENGINE     node: '^18.13.0 || >=20.9.0',
    npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6 || >=8.0.0',
    npm WARN EBADENGINE     yarn: '>= 1.13.0'
    npm WARN EBADENGINE   },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: '@schematics/angular@17.2.3',
    npm WARN EBADENGINE   required: {
    npm WARN EBADENGINE     node: '^18.13.0 || >=20.9.0',
    npm WARN EBADENGINE     npm: '^6.11.0 || ^7.5.6 || >=8.0.0',
    npm WARN EBADENGINE     yarn: '>= 1.13.0'
    npm WARN EBADENGINE   },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm WARN EBADENGINE Unsupported engine {
    npm WARN EBADENGINE   package: 'inquirer@9.2.14',
    npm WARN EBADENGINE   required: { node: '>=18' },
    npm WARN EBADENGINE   current: { node: 'v16.15.0', npm: '8.5.5' }
    npm WARN EBADENGINE }
    npm ERR! code ENOTFOUND
    npm ERR! syscall getaddrinfo
    npm ERR! errno ENOTFOUND
    npm ERR! network request to https://example-company-private-repo.org/npm/all-npm/@schematics/angular/-/angular-17.2.3.tgz failed, reason: getaddrinfo ENOTFOUND artifactory.ci.gameop.net
    npm ERR! network This is a problem related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settings.
    npm ERR! network 
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
    

    I think this could be nvm rather than ng.
    I could not replicate the original issue when I didn't use NVM.
    Issue npm/cli#5460 ?
    Sam

  6. alan-agius4 commented on Mar 12, 2024

    @alan-agius4
    Collaborator

    During ng update, Angular CLI temporarily installs itself, generating a new directory, such as /private/var/folders/qw/95f4vfgn1wb8gz402xpx0n6w0000gp/T/angular-cli-packages-StDlIR, where it executes npm install to fetch the latest Angular CLI version for the update. However, NPM fails to locate the project's .npmrc configuration in this location.

    For ng new, you can utilize the --skip-install flag, create the .npmrc file after the command completes, and manually execute npm install.

    However, as highlighted in npm/cli#5460 (comment), unless your company's NPM repository also functions as a proxy to the public repository, employing scopes would certainly be a more recommended approach.

  7. added
    freq1: lowOnly reported by a handful of users who observe it rarely
    and removed
    needs: investigationRequires some digging to determine if action is needed
    on Mar 12, 2024
  8. samwootton commented on Mar 12, 2024

    @samwootton
    Author

    Thanks @alan-agius4.
    I'll follow your steps for ng new.
    Is a change going to be made to ng update?
    Sam

  9. alan-agius4 commented on Mar 12, 2024

    @alan-agius4
    Collaborator

    Yes, but there is no ETA for the ng update bug fix.

  10. jontze commented on Apr 11, 2024

    @jontze

    I had the same issue with ng update ignoring my .npmrc config, where the private registry serves as a proxy.

    I recognized that only the temporary installation of the newer @angular/cli is not respecting the .npmrc config. So to work around this, I updated the Angular CLI manually in the package.json and installed it. After that, I could use the ng update command as usual and also apply the updates and migrations of other Angular packages via the private proxy registry.

  11. samwootton commented on Oct 26, 2024

    @samwootton
    Author

    Is there any update on a fix for this issue?

  12. muuvmuuv commented on Nov 20, 2024

    @muuvmuuv

    Having a little different issue that it just not pick my .npmrc from the root project directory when running ng update in a monorepo application project directory.

  13. added 2 commits that reference this issue on Apr 8, 2026
    6aa2cd4
    7613be7
  14. angular-automatic-lock-bot commented on Jul 18, 2026

    @angular-automatic-lock-bot

    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.

  15. locked and limited conversation to collaborators on Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions