diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0db844..596a040 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-node@v2-beta + - uses: actions/setup-node@v2 with: node-version: "14" - run: npm install diff --git a/.github/workflows/toc.yml b/.github/workflows/toc.yml index 879e409..55ea20f 100644 --- a/.github/workflows/toc.yml +++ b/.github/workflows/toc.yml @@ -17,7 +17,7 @@ jobs: # pulls all tags (needed for lerna / semantic release to correctly version) - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v2 with: node-version: '12.x' - run: npm install diff --git a/Makefile b/Makefile index db0c21f..cc2944b 100644 --- a/Makefile +++ b/Makefile @@ -80,6 +80,6 @@ release: _ensure-tag _ensure-clean _ensure-current-version new_ver=`semver -i "$$new_ver" "$$old_ver"` || { echo 'Invalid version-increment specifier: $(TAG)' >&2; exit 2; } \ fi; \ printf "=== Bumping version **$$old_ver** to **$$new_ver** before committing and tagging:\n=== TYPE 'proceed' TO PROCEED, anything else to abort: " && read response && [ "$$response" = 'proceed' ] || { echo 'Aborted.' >&2; exit 2; }; \ - replace "$$old_ver" "$$new_ver" -- $(VERSIONED_FILES) && \ + replace "$$old_ver" "$$new_ver" $(VERSIONED_FILES) && \ git commit -m "v$$new_ver" $(VERSIONED_FILES) && \ git tag -a "v$$new_ver" diff --git a/README.md b/README.md index 53b3710..d391342 100644 --- a/README.md +++ b/README.md @@ -320,7 +320,7 @@ Note that reinstalling packages _explicitly does not update the npm version_ — To update npm at the same time add the `--latest-npm` flag, like this: ```sh -nvm install lts/* --reinstall-packages-from=default --latest-npm +nvm install 'lts/*' --reinstall-packages-from=default --latest-npm ``` or, you can at any time run the following command to get the latest supported npm version on the current node version: @@ -871,3 +871,49 @@ Ignore insecure directories and continue [y] or abort compinit [n]? y ``` Homebrew causes insecure directories like `/usr/local/share/zsh/site-functions` and `/usr/local/share/zsh`. This is **not** an `nvm` problem - it is a homebrew problem. Refer [here](https://github.com/zsh-users/zsh-completions/issues/680) for some solutions related to the issue. + +**Macs with M1 chip** + +_January 2021:_ there are no pre-compiled NodeJS binaries for versions prior to 15.x for Apple's new M1 chip (arm64 architecture). + +Some issues you may encounter: + +- using `nvm` to install, say, `v14.15.4`: + - the C code compiles successfully + - but crashes with an out of memory error when used + - increasing the memory available to node still produces the out of memory errors: + ```sh + $ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package + ``` +- when using `nvm` to install some versions, the compilation fails + +One solution to this issue is to change the architecture of your shell from arm64 to x86. + +Let's assume that: +- you already have versions `12.20.1` and `14.15.4` installed using `nvm` +- the current version in use is `14.15.4` +- you are using the `zsh` shell + +```sh +# Check what version you're running: +$ node --version +v14.15.4 +# Check architecture of the `node` binary: +$ node -p process.arch +arm64 +# This confirms that the arch is for the M1 chip, which is causing the problems. +# So we need to uninstall it. +# We can't uninstall the version we are currently using, so switch to another version: +$ nvm install v12.20.1 +# Now uninstall the version we want to replace: +$ nvm uninstall v14.15.4 +# Set the architecture for our shell to 64-bit X86: +$ arch -x86_64 zsh +# Install node using nvm. This should download the precompiled x64 binary: +$ nvm install v14.15.4 +# Now check that the architecture is correct: +$ node -p process.arch +x64 +# It is now safe to revert zsh back to the native architecture: +$ arch -arm64 zsh +``` diff --git a/nvm.sh b/nvm.sh index 8d57cae..e0eccfe 100644 --- a/nvm.sh +++ b/nvm.sh @@ -3078,7 +3078,7 @@ nvm() { nvm_ensure_default_set "${provided_version}" fi - if [ -n "${ALIAS}" ]; then + if [ -n "${ALIAS-}" ]; then nvm alias "${ALIAS}" "${provided_version}" fi diff --git a/package.json b/package.json index 1c683bb..f520f7e 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,10 @@ "homepage": "https://github.com/nvm-sh/nvm", "devDependencies": { "dockerfile_lint": "^0.3.2", - "doctoc": "^1.2.0", + "doctoc": "^2.0.0", "eclint": "^2.6.0", - "replace": "^0.3.0", - "semver": "^5.0.1", + "replace": "^1.2.0", + "semver": "^7.3.4", "urchin": "^0.0.5" } }