-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] The before
date in .npmrc
is not parsed as Date
so every install fails
#6235
Comments
npm ci
doesn't parse the date in .npmrc
as Datebefore
date in .npmrc
is not parsed as Date
so every install fails
This is definitely an npm bug. ~/D/n/s/before $ cat .npmrc
before=2022-10-26
~/D/n/s/before $ node /Users/wraithgar/Development/npm/cli/branches/main/ config get before
2022-10-26
~/D/n/s/before $ node /Users/wraithgar/Development/npm/cli/branches/main/ config get before --before='2022-10-16'
Sat Oct 15 2022 17:00:00 GMT-0700 (Pacific Daylight Time) |
Thanks! I also want to report that this is a regression. It worked in 2022 (npm v9.2.0):
|
The |
Yes my repro just use the flag to reset npm’s version, but the following |
The underlying bug has always been there. Something between now and then is making pacote look at ~/D/n/s/before $ cat .npmrc
before=2022-10-26
~/D/n/s/before $ ./node_modules/.bin/npm config get before
2022-10-26
~/D/n/s/before $ ./node_modules/.bin/npm -v
9.2.0 |
Is there an existing issue for this?
Current Behavior
As in the title, this
.npmrc
file will cause installs to fail because the value is passed to pacote as astring
while pacote expects aDate
:I'm opening the issue here because it can be fixed here, but it's possible this is a bug within
npm-cli
instead. I wasn't able to find the exact part that dealt with this conversion elsewhere.https://github.com/npm/pacote/blob/7a560db966140db65b8f000de4d36eb36e0a7760/lib/fetcher.js#L125
Expected Behavior
A date in .npmrc should be handled the same way as a date passed as
npm ci --before=2022-10-26T00:00:00.000Z
I don't know if a fix belongs here, but in my case it might be as easy as
typeof before === string ? new Date(before) : before
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: