Installing Node with nodebrew on an M1 Mac

2021-11-27 18:43 (3 years ago) ytyng

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

Current rating: 4

Comments

Archive

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011