Installing Node with nodebrew on an M1 Mac

As of November 27, 2021, node-sass does not work on M1 Macs. Instead, if you use dart sass (the sass package), note that it may not work with Node 16 or later versions, making Node 15 the stable choice.
(You might encounter the error: Assertion failed: (thread_id_key != 0x7777), function find_thread_id_key, file coroutine.cc, line 134.)
https://qiita.com/kuroro_ru/items/c907bf076002a5a985d0
Installing nodebrew
curl -L git.io/nodebrew | perl - setup
After installation, set the environment variables as instructed.
export PATH=$HOME/.nodebrew/current/bin:$PATH
Checking Available Versions
nodebrew ls-remote
Downloading and Compiling Source Code
nodebrew compile v15.14.0
Although you might be inclined to run nodebrew install v...., there are generally no binaries for Darwin ARM in the repository (though there are binaries for Linux ARM and Darwin x64), so the installation will fail.
Therefore, if you are using an M1 Mac, you need to compile it yourself.
Once it's compiled, you can run
nodebrew use v15.14.0
Related posts
Trying to Install npm install fibers (node-fibers) Results in ValueError: invalid mode: 'rU' While Trying to Load binding.gyp
When Setting the Path for mysql-client Installed via Homebrew on macOS, It Automatically Follows Version Changes
Run a JavaScript Script File from the Terminal on Mac
Installing Cryptography (cffi) on M1 Mac
We look forward to discussing your development needs.