There are no pre-compiled NodeJS binaries for versions prior to 15.x for Apple's new M1 chip (arm64 architecture).
Experimental support for the M1 architecture was added in node.js v15.3 and full support was added in v16.0. Because of this, if you try to install older versions of node as usual, you will probably experience either compilation errors when installing node or out-of-memory errors while running your code.
Launch a new zsh process under the 64-bit X86 architecture:
arch -x86_64 zsh
Check that the architecture is correct:
node -p process.arch
Do your thing!
nvm install v8.17.0 nvm use v8.17.0
Now using node v8.17.0 (npm v6.13.4)