corepack
corepack copied to clipboard
How to corepack self update?
How should I update the version of corepack?
Since corepack is installed system-wide with Node, it's likely that existing installations (like my Windows machine) will have outdated versions.
For example, the LTS Node installer installs 0.18.0 but the latest version is 0.20.0 and has commands that don't exist in previous versions.
A couple options:
- Edit
$PATHso theC:\Users\dan\AppData\Roaming\npmcomes beforeC:\Program Files\nodejsandnpm install --global corepack - Alias
corepack='npx corepack@latest'in my shell profile. - Use a package manager to overwrite the global corepack:
cd 'C:\Program Files\nodejs'; npm install corepack@latest --prefix . - Don't install corepack using the Node installer. Instead
npm install --global corepack
I think just running npm install --global corepack@latest is fine which will replace the symlink to the corepack binary shipped with the node installation? Maybe not on Windows 🤷🏻♂️
No, on Windows it is not working
The first workaround offered by @rotu works well on windows if corepack is already installed through your nodejs install, though you may have to move the path of nodejs from system to user variables.