Installing Node.js on an M1
After installing Flutter, I installed Node.js. It turns out there isn't a build of version 14.5.3 (LTS) for M1 yet. But they say that there is a build of version 15, which you can install via nvm.
- Installing NVM: https://github.com/nvm-sh/nvm#install--update-script
- Installing node 15:
nvm install node15
. It took about 10 minutes to compile.
% nvm i v15
Downloading and installing node v15.5.0...
Downloading https://nodejs.org/dist/v15.5.0/node-v15.5.0-darwin-arm64.tar.xz...
##O#- #
curl: (22) The requested URL returned error: 404
Binary download from https://nodejs.org/dist/v15.5.0/node-v15.5.0-darwin-arm64.tar.xz failed, trying source.
...
installing $home/.nvm/versions/node/v15.5.0/include/node/zlib.h
Now using node v15.5.0 (npm v7.3.0)
Creating default alias: default -> v15 (-> v15.5.0)
anhtuan@mac-mini ~ % node
Welcome to Node.js v15.5.0.
Type ".help" for more information.
>
(To exit, press Ctrl+C again or Ctrl+D or type .exit)
See this post for details. Also this is the official GitHub ticket about the M1 build. They say running natively bring a 30% performance improvement.