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

export N_NODE_MIRROR is useless for sudo operation #584

Closed
yuu2lee4 opened this issue Aug 21, 2019 · 4 comments
Closed

export N_NODE_MIRROR is useless for sudo operation #584

yuu2lee4 opened this issue Aug 21, 2019 · 4 comments

Comments

@yuu2lee4
Copy link

export N_NODE_MIRROR=https://npm.taobao.org/mirrors/node & sudo n 10.16.3

it still fetch node from https://nodejs.org

@shadowspawn
Copy link
Collaborator

shadowspawn commented Aug 21, 2019

You need to tell sudo that you want to use the existing environment variables.

For example, on Mac looks like:

export N_NODE_MIRROR=https://npm.taobao.org/mirrors/node
sudo -E n 10.16.3

From sudo man page:

-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing
environment variables. The security policy may return an error if the user does
not have permission to preserve the environment.

@yuu2lee4
Copy link
Author

ok thanks for your help

@fahrulalwan
Copy link

maybe you should add those to readme.md (?)

@ccforeverd
Copy link

You need to tell sudo that you want to use the existing environment variables.

For example, on Mac looks like:

export N_NODE_MIRROR=https://npm.taobao.org/mirrors/node
sudo -E n 10.16.3

From sudo man page:

-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing
environment variables. The security policy may return an error if the user does
not have permission to preserve the environment.

Thanks!

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

No branches or pull requests

4 participants