Skip to content

ng add gives errors with a before parameter in the .npmrc file #24685

Closed
@cherezovvv

Description

@cherezovvv

Command

add

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

For before parameter in npm config, value is of type string, for example before = 2023-02-09T08:45:22.778Z.
packument function of pacote package, expects before as js Date type.
It seems to me that it is necessary to add a date type conversion in the normalizeOptions function in packages/angular/cli/src/utilities/package-metadata.ts

Minimal Reproduction

  1. Add before parameter to npm config (.npmrc file) - before = 2023-02-09T08:45:22.778Z
  2. Run script ng add @angular/material

Exception or Error

`Unable to load package information from registry: this.before.toISOString is not a function`

Your Environment

Angular CLI: 13.2.5
Node: 16.14.0
Package Manager: npm 8.3.1
OS: linux x64
Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.5
@angular-devkit/build-angular   13.2.5
@angular-devkit/core            13.2.5
@angular-devkit/schematics      13.2.5
@angular/cli                    13.2.5
@schematics/angular             13.2.5
rxjs                            7.5.4
typescript                      4.5.5

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions