Skip to content
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

NPM_CONFIG_REGISTRY environment variable is not respected #25822

Closed
leonco opened this issue Sep 23, 2024 · 7 comments · Fixed by #26473
Closed

NPM_CONFIG_REGISTRY environment variable is not respected #25822

leonco opened this issue Sep 23, 2024 · 7 comments · Fixed by #26473
Assignees
Labels
bug Something isn't working correctly install

Comments

@leonco
Copy link

leonco commented Sep 23, 2024

Version:

deno 2.0.0-rc.4 (release candidate, release, x86_64-pc-windows-msvc)
v8 12.9.202.13-rusty
typescript 5.6.2
> Deno.env.get("NPM_CONFIG_REGISTRY")
"https://registry.npmmirror.com/"
>
deno install npm:prisma-kysely
Add npm:[email protected]
error: Error getting response at https://registry.npmjs.org/prisma-kysely for package "prisma-kysely": error sending request for url (https://registry.npmjs.org/prisma-kysely): client error (Connect): 远程主机强迫关闭了一个现有的连接。 (os error 10054)

@marvinhagemeister
Copy link
Contributor

That's odd. We have tests that check that this works and during testing we test all the npm installation stuff with our own mock registry.

https://github.com/denoland/deno/blob/main/tests/specs/node_compat_tests/node_test_module/__test__.jsonc#L6

Can you post the output of running the following command on your machine?

NPM_CONFIG_REGISTRY="https://registry.npmmirror.com/" DENO_LOG=debug deno install npm:prisma-kysely

@marvinhagemeister marvinhagemeister added the needs info needs further information to be properly triaged label Sep 23, 2024
@leonco
Copy link
Author

leonco commented Sep 24, 2024

DEBUG RS - deno_config::deno_json:781 - Config file found at 'H:\hlbcg\repo\hello-prisma-2\deno.json'
DEBUG RS - deno_config::workspace::discovery:263 - package.json file found at 'H:\hlbcg\repo\hello-prisma-2\package.json'
DEBUG RS - deno::args:915 - Finished config loading.
DEBUG RS - deno::file_fetcher:641 - FileFetcher::fetch_no_follow_with_options - specifier: https://registry.npmmirror.com/prisma-kysely
DEBUG RS - deno::file_fetcher:375 - FileFetcher::fetch_remote_no_follow - specifier: https://registry.npmmirror.com/prisma-kysely
DEBUG RS - hyper_util::client::legacy::connect::dns:122 - resolving host="registry.npmmirror.com"
DEBUG RS - hyper_util::client::legacy::connect::http:643 - connecting to 119.147.148.206:443
DEBUG RS - hyper_util::client::legacy::connect::http:646 - connected to 119.147.148.206:443
DEBUG RS - h2::client:1281 - binding client connection
DEBUG RS - h2::client:1286 - client connection bound
DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 }
DEBUG RS - h2::proto::connection:138 - Connection; peer=Client
DEBUG RS - hyper_util::client::legacy::pool:396 - pooling idle connection for ("https", registry.npmmirror.com)
DEBUG RS - h2::codec::framed_write:213 - send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x0), max_concurrent_streams: 128, initial_window_size: 65536, max_frame_size: 16777215 }
DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x1: ACK) }
DEBUG RS - h2::codec::framed_read:405 - received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 2147418112 }
DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x1: ACK) }
DEBUG RS - h2::proto::settings:56 - received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 }
DEBUG RS - h2::codec::framed_read:405 - received frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
Add npm:[email protected]
DEBUG RS - deno_config::deno_json:781 - Config file found at 'H:\hlbcg\repo\hello-prisma-2\deno.json'
DEBUG RS - deno_config::workspace::discovery:263 - package.json file found at 'H:\hlbcg\repo\hello-prisma-2\package.json'
DEBUG RS - deno::args:915 - Finished config loading.
DEBUG RS - deno::npm::managed::resolution:282 - Running npm resolution.
DEBUG RS - hyper_util::client::legacy::connect::dns:122 - resolving host="registry.npmjs.org"
DEBUG RS - hyper_util::client::legacy::connect::http:643 - connecting to 104.16.25.34:443
DEBUG RS - deno_npm::resolution::graph:927 - <package-req> - Resolved prisma-kysely@^1.8.0 to [email protected]
DEBUG RS - hyper_util::client::legacy::connect::http:646 - connected to 104.16.25.34:443
DEBUG RS - h2::client:1281 - binding client connection
DEBUG RS - h2::client:1286 - client connection bound
DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 }
DEBUG RS - h2::proto::connection:138 - Connection; peer=Client
DEBUG RS - hyper_util::client::legacy::pool:396 - pooling idle connection for ("https", registry.npmjs.org)
DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x0), max_concurrent_streams: 100, initial_window_size: 65536, max_frame_size: 16777215 }
DEBUG RS - h2::codec::framed_write:213 - send frame=Settings { flags: (0x1: ACK) }
DEBUG RS - h2::codec::framed_read:405 - received frame=WindowUpdate { stream_id: StreamId(0), size_increment: 2147418112 }
DEBUG RS - h2::codec::framed_write:213 - send frame=WindowUpdate { stream_id: StreamId(0), size_increment: 5177345 }
DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(1), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Settings { flags: (0x1: ACK) }
DEBUG RS - h2::proto::settings:56 - received settings ACK; applying Settings { flags: (0x0), enable_push: 0, initial_window_size: 2097152, max_frame_size: 16384, max_header_list_size: 16384 }
DEBUG RS - h2::codec::framed_read:405 - received frame=Headers { stream_id: StreamId(1), flags: (0x4: END_HEADERS) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1) }
DEBUG RS - h2::codec::framed_read:405 - received frame=Data { stream_id: StreamId(1), flags: (0x1: END_STREAM) }
DEBUG RS - deno_npm::resolution::graph:927 - <package-req> - Resolved @mrleebo/prisma-ast@* to @mrleebo/[email protected]
DEBUG RS - deno_npm::resolution::graph:927 - [email protected] - Resolved @mrleebo/prisma-ast@^0.7.0 to @mrleebo/[email protected]
DEBUG RS - hyper_util::client::legacy::pool:270 - reuse idle connection for ("https", registry.npmjs.org)
DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(3), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG RS - hyper_util::client::legacy::pool:270 - reuse idle connection for ("https", registry.npmjs.org)
DEBUG RS - hyper_util::client::legacy::pool:270 - reuse idle connection for ("https", registry.npmjs.org)
DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(5), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG RS - h2::codec::framed_write:213 - send frame=Headers { stream_id: StreamId(7), flags: (0x5: END_HEADERS | END_STREAM) }
DEBUG RS - h2::proto::connection:461 - Connection::poll; IO error error=ConnectionReset
DEBUG RS - hyper_util::client::legacy::client:569 - client connection error: connection error
DEBUG RS - h2::codec::framed_write:213 - send frame=GoAway { error_code: NO_ERROR, last_stream_id: StreamId(0) }
DEBUG RS - h2::proto::connection:428 - Connection::poll; connection error error=GoAway(b"", NO_ERROR, Library)
error: Error getting response at https://registry.npmjs.org/@prisma/generator-helper for package "@prisma/generator-helper": error sending request from 172.16.111.251:60802 for https://registry.npmjs.org/@prisma/generator-helper (104.16.25.34:443): client error (SendRequest): connection error: connection reset

@lucacasonato
Copy link
Member

That is very odd - I can not reproduce it on Linux with NPM_CONFIG_REGISTRY="https://registry.npmmirror.com/" DENO_LOG=debug deno info -Ldebug npm:prisma-kysely. @dsherret do you have any ideas? Could this somehow be windows specific?

@dsherret
Copy link
Member

dsherret commented Sep 25, 2024

@leonco do you have an .npmrc file in your current directory or home directory? It should log that out in the debug log if so.

Edit: Oh, I guess that's the full output and it doesn't say that

@leonco
Copy link
Author

leonco commented Sep 26, 2024

yes, I have a .npmrc file in home directory

registry=https://registry.npmjs.org/

There are multiple places to configure the npm registry. Can you tell me about your processing logic?

@dsherret

@dsherret
Copy link
Member

I think the env var has the lowest precedence. It seems some of the code incorrectly uses the env var when it should be using the npmrc though.

@marvinhagemeister marvinhagemeister added bug Something isn't working correctly install and removed needs info needs further information to be properly triaged labels Oct 17, 2024
@bartlomieju
Copy link
Member

FYI you can upgrade to canary version to get this fix immediately (deno upgrade canary) or wait until stable Deno v2.0.3 that should be released tonight.

bartlomieju added a commit that referenced this issue Oct 25, 2024
We weren't passing the resolved npmrc settings to the install commands.
This lead us to always fall back to the default registry url instead of
using the one from npmrc.

Fixes #26139
Fixes #26033
Fixes #25924
Fixes #25822
Fixes #26152

---------

Co-authored-by: Bartek Iwańczuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly install
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants