The MacPorts project (http://www.macports.org/) has for years been packaging a long list of open source software packages for macOS, and they have packaged Node.js. After you have installed MacPorts using the installer on their website, installing Node.js is pretty much this simple:
$ port search nodejs npm...nodejs6 @6.12.0 (devel, net) Evented I/O for V8 JavaScriptnodejs7 @7.10.1 (devel, net) Evented I/O for V8 JavaScriptnodejs8 @8.9.1 (devel, net) Evented I/O for V8 JavaScriptnodejs9 @9.2.0 (devel, net) Evented I/O for V8 JavaScriptFound 6 ports.--npm4 @4.6.1 (devel) node package managernpm5 @5.5.1 (devel) node package managerFound 4 ports.$ sudo port install nodejs8 npm5 .. long log of downloading and ...