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

fix: set 'npm_config_user_agent' env var when installing or running npm deps #26311

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bartlomieju
Copy link
Member

Closes #25342

pub async fn maybe_npm_install(factory: &CliFactory) -> Result<(), AnyError> {
std::env::set_var("npm_config_user_agent", get_npm_config_user_agent());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really correct. I believe we want to set it every time we install npm packages, when executing deno run npm:<package_name> and when running deno task that calls a bin entry of a package.

Copy link
Member

@nathanwhit nathanwhit Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the deno run case, it feels like it might just be easiest to set it unconditionally, instead of trying to detect when an NPM package will run.

For the other two, setting it in task_runner.rs (in most of the ShellCommand impls) should do it I think. That would cover lifecycle scripts/deno install and deno task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set npm_config_user_agent when running scripts
2 participants