Currently, node on M1 macOS doesn’t work well except node@15.
If you using node@12 built on arm64 architecture, it may be crashed on some scripts such as https://github.com/dcodeIO/long.js.git
You can check it if you run test cases in long.js repository.
If you would like to know on which your node is built, please follow this:
$ node
Welcome to Node.js v12.21.0.
Type ".help" for more information.
>
> process.arch
'arm64'
The above example means the node binary is built for arm64 architecture (Apple Silicon M1 chip). If node is run on rosetta2, it will display ‘x64’.
I have tested some test cases in long.js and node.js source repository.
- Node@15 for arm64: no problem
- Node@12 for arm64: some errors in long.js and node.js test cases
- Node@12 for x64: no problem
As I know, node@12 for arm64 works well for some scripts, but some scripts has been crashed such as long.js.
Edit
On June 21th, 2021, node@14 on Homebrew has passed long.js test cases for arm64. (v14.17.1)
Of course, node@16 also supports it.
But, node@12 still has errors on them. (v12.22.1)