Skip to content
Myr

[readme] Add macOS troubleshooting instructions for M1 chip

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Matt Calthrop · committed by Jordan Harband · parent 3243f7a · Browse files · 1 file+52 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+52 added−0 removed

  • other:+52 added−0 removed

1 file+52 added−0 removed

modified:README.md+52 added
869 unmodified lines
870Ignore insecure directories and continue [y] or abort compinit [n]? y871```872873Homebrew 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.874875**Macs with M1 chip**876877_January 2021:_ there are no pre-compiled NodeJS binaries for versions prior to 15.x for Apple's new M1 chip (arm64 architecture).878879Some issues you may encounter:880881- using `nvm` to install, say, `v14.15.4`:882 - the C code compiles successfully883 - but crashes with an out of memory error when used884 - increasing the memory available to node still produces the out of memory errors:885 ```sh886 $ NODE_OPTIONS="--max-old-space-size=4096" ./node_modules/.bin/your_node_package887 ```888- when using `nvm` to install some versions, the compilation fails889890One solution to this issue is to change the architecture of your shell from arm64 to x86.891892Let's assume that:893- you already have versions `12.20.1` and `14.15.4` installed using `nvm`894- the current version in use is `14.15.4`895- you are using the `zsh` shell896897```sh898# Check what version you're running:899$ node --version900v14.15.4901# Check architecture of the `node` binary:902$ node -p process.arch903arm64904# This confirms that the arch is for the M1 chip, which is causing the problems.905# So we need to uninstall it.906# We can't uninstall the version we are currently using, so switch to another version:907$ nvm install v12.20.1908# Now uninstall the version we want to replace:909$ nvm uninstall v14.15.4910# Set the architecture for our shell to 64-bit X86:911$ arch -x86_64 zsh912```913914At this point in time, we are still in the shell that is running using the M1 architecture.915916So we now need to open a new terminal window in order to run our shell in the 64-bit X86 architecture.917918```sh919# `node` will not be on the path in this new terminal window.920# So install it:921$ nvm install v14.15.4922# Now check that the architecture is correct:923$ node -p process.arch924x64925```