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

Feature Request: Preserve corepack with --preserve (or env variable) #735

Closed
Mitsunee opened this issue Jul 3, 2022 · 2 comments
Closed

Comments

@Mitsunee
Copy link

Mitsunee commented Jul 3, 2022

Problem

corepack is not preserved, thus installed node16 reverts me back to corepack@0.10.0 every time.

Short Version

corepack should be preserved when npm is getting preserved

Long Version

When --preserve or N_PRESERVE_NPM=1 are given npm is preserved, but corepack should also be preserved in that case. Alternatively a N_PRESERVE_COREPACK env variable would be acceptable.

My ideal outcome is that none of the globally installed packages should be touched at all by switching node versions as this possibly hinders my workflow.

Configuration Details

$ n --version
v8.2.0

$ command -v node
/home/mitsu/.local/bin/node # as intended using a symlink to $N_PREFIX/bin/node

$ node -p process.platform
linux # Fedora 36 KDE Spin

# .bashrc
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

export N_PREFIX="$XDG_DATA_HOME/node"
export N_CACHE_PREFIX="$XDG_CACHE_HOME"
export N_PRESERVE_NPM=1
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc"
export NODE_REPL_HISTORY="$XDG_STATE_HOME/node_repl/history"
@Mitsunee Mitsunee changed the title Feature Request: Preserve corepack with N_PRESERVE_NPM is 1 Feature Request: Preserve corepack with --preserve (or env variable) Jul 3, 2022
@shadowspawn
Copy link
Collaborator

I did wonder about how to treat corepack when it was added. I decided at the time that it was an additional part of the Node.js install and not part of npm as such.

So for the environment variable, I think a separate environment variable N_PRESERVE_COREPACK is more appropriate than using the "npm" named one.

I'm unsure about --preserve. I'm currently leaning towards --preserve being preserve-all-the-things so covering both npm and corepack.

@shadowspawn
Copy link
Collaborator

Shipped in v9.0.0

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

No branches or pull requests

2 participants