mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-12-11 23:54:18 +00:00
Compare commits
2 Commits
565990847b
...
fix-3474
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f91e99415 | ||
|
|
f7363acbb9 |
5
.github/workflows/latest-npm.yml
vendored
5
.github/workflows/latest-npm.yml
vendored
@@ -37,11 +37,6 @@ jobs:
|
||||
matrix:
|
||||
node-version: ${{ fromJson(needs.matrix.outputs.latest) }}
|
||||
include:
|
||||
- node-version: "21"
|
||||
- node-version: "20.5"
|
||||
- node-version: "20.4"
|
||||
- node-version: "14.17"
|
||||
- node-version: "14.16"
|
||||
- node-version: "9.2"
|
||||
- node-version: "9.1"
|
||||
- node-version: "9.0"
|
||||
|
||||
3
.github/workflows/toc.yml
vendored
3
.github/workflows/toc.yml
vendored
@@ -20,7 +20,6 @@ jobs:
|
||||
allowed-endpoints:
|
||||
github.com:443
|
||||
registry.npmjs.org:443
|
||||
api.github.com:443
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
# https://github.com/actions/checkout/issues/217#issue-599945005
|
||||
@@ -31,7 +30,7 @@ jobs:
|
||||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 'lts/*'
|
||||
node-version: '16'
|
||||
- run: npm install
|
||||
- run: npm run doctoc
|
||||
- name: commit changes
|
||||
|
||||
@@ -588,9 +588,7 @@ Run [`npx nvmrc`](https://npmjs.com/nvmrc) to validate an `.nvmrc` file. If that
|
||||
|
||||
### Deeper Shell Integration
|
||||
|
||||
You can use [`avn`](https://github.com/wbyoung/avn) to deeply integrate into your shell and automatically invoke `nvm` when changing directories. `avn` is **not** supported by the `nvm` maintainers. Please [report issues to the `avn` team](https://github.com/wbyoung/avn/issues/new).
|
||||
|
||||
You can also use [`nvshim`](https://github.com/iamogbz/nvshim) to shim the `node`, `npm`, and `npx` bins to automatically use the `nvm` config in the current directory. `nvshim` is **not** supported by the `nvm` maintainers. Please [report issues to the `nvshim` team](https://github.com/iamogbz/nvshim/issues/new).
|
||||
You can use [`nvshim`](https://github.com/iamogbz/nvshim) to shim the `node`, `npm`, and `npx` bins to automatically use the `nvm` config in the current directory. `nvshim` is **not** supported by the `nvm` maintainers. Please [report issues to the `nvshim` team](https://github.com/iamogbz/nvshim/issues/new).
|
||||
|
||||
If you prefer a lighter-weight solution, the recipes below have been contributed by `nvm` users. They are **not** supported by the `nvm` maintainers. We are, however, accepting pull requests for more examples.
|
||||
|
||||
|
||||
25
nvm.sh
25
nvm.sh
@@ -354,21 +354,6 @@ nvm_install_latest_npm() {
|
||||
if [ $NVM_IS_19_OR_ABOVE -eq 1 ] && nvm_version_greater_than_or_equal_to "${NODE_VERSION}" 20.5.0; then
|
||||
NVM_IS_20_5_OR_ABOVE=1
|
||||
fi
|
||||
local NVM_IS_20_17_or_ABOVE
|
||||
NVM_IS_20_17_or_ABOVE=0
|
||||
if [ $NVM_IS_20_5_OR_ABOVE -eq 1 ] && nvm_version_greater 20.17.0 "${NODE_VERSION}"; then
|
||||
NVM_IS_20_17_or_ABOVE=1
|
||||
fi
|
||||
local NVM_IS_21_OR_ABOVE
|
||||
NVM_IS_21_OR_ABOVE=0
|
||||
if [ $NVM_IS_20_17_or_ABOVE -eq 1 ] && nvm_version_greater 21.0.0 "${NODE_VERSION}"; then
|
||||
NVM_IS_21_OR_ABOVE=1
|
||||
fi
|
||||
local NVM_IS_22_9_OR_ABOVE
|
||||
NVM_IS_22_9_OR_ABOVE=0
|
||||
if [ $NVM_IS_21_OR_ABOVE -eq 1 ] && nvm_version_greater 22.9.0 "${NODE_VERSION}"; then
|
||||
NVM_IS_22_9_OR_ABOVE=1
|
||||
fi
|
||||
|
||||
if [ $NVM_IS_4_4_OR_BELOW -eq 1 ] || {
|
||||
[ $NVM_IS_5_OR_ABOVE -eq 1 ] && nvm_version_greater 5.10.0 "${NODE_VERSION}"; \
|
||||
@@ -416,12 +401,6 @@ nvm_install_latest_npm() {
|
||||
; then
|
||||
nvm_echo '* `npm` `v9.x` is the last version that works on `node` `< v18.17`, `v19`, or `v20.0` - `v20.4`'
|
||||
$NVM_NPM_CMD install -g npm@9
|
||||
elif \
|
||||
[ $NVM_IS_20_17_or_ABOVE -eq 0 ] \
|
||||
|| { [ $NVM_IS_21_OR_ABOVE -eq 1 ] && [ $NVM_IS_22_9_OR_ABOVE -eq 0 ]; } \
|
||||
; then
|
||||
nvm_echo '* `npm` `v10.x` is the last version that works on `node` `< v20.17`, `v21`, or `v22.0` - `v22.8`'
|
||||
$NVM_NPM_CMD install -g npm@10
|
||||
else
|
||||
nvm_echo '* Installing latest `npm`; if this does not work on your node version, please report a bug!'
|
||||
$NVM_NPM_CMD install -g npm
|
||||
@@ -1688,10 +1667,11 @@ EOF
|
||||
LTS="${LTS#lts/}"
|
||||
fi
|
||||
|
||||
VERSIONS="$({ command awk -v lts="${LTS-}" '{
|
||||
VERSIONS="$({ command awk -v lts="${LTS-}" -v pattern="${PATTERN:-.*}" '{
|
||||
if (!$1) { next }
|
||||
if (lts && $10 ~ /^\-?$/) { next }
|
||||
if (lts && lts != "*" && tolower($10) !~ tolower(lts)) { next }
|
||||
if ($1 !~ pattern) { next }
|
||||
if ($10 !~ /^\-?$/) {
|
||||
if ($10 && $10 != prev) {
|
||||
print $1, $10, "*"
|
||||
@@ -1703,7 +1683,6 @@ EOF
|
||||
}
|
||||
prev=$10;
|
||||
}' \
|
||||
| nvm_grep -w "${PATTERN:-.*}" \
|
||||
| $SORT_COMMAND; } << EOF
|
||||
$VERSION_LIST
|
||||
EOF
|
||||
|
||||
@@ -6,7 +6,7 @@ die () { echo "$@" ; exit 1; }
|
||||
\. ../../../nvm.sh
|
||||
|
||||
# Version to install/uninstall
|
||||
NVM_TEST_VERSION=15.5.0
|
||||
NVM_TEST_VERSION=5.10.1
|
||||
|
||||
# Make sure it's not already here
|
||||
[ -e ../../../$NVM_TEST_VERSION ] && rm -R ../../../$NVM_TEST_VERSION
|
||||
@@ -19,9 +19,7 @@ nvm ls | grep "$NVM_TEST_VERSION" || die "Failed to install node"
|
||||
|
||||
# Install global module as root
|
||||
npm_path=$(which npm)
|
||||
nvm_err "${PATH}"
|
||||
PATH="${PATH}" sudo -n echo "${PATH}" || die 'sudo echo failed'
|
||||
PATH="${PATH}" sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`'
|
||||
sudo -n "$npm_path" install jspm@'<2' -g || die 'either sudo failed, or `npm install jspm -g` failed`'
|
||||
|
||||
# Switch to another version so we can uninstall
|
||||
nvm use 0.12.7
|
||||
|
||||
Reference in New Issue
Block a user