NodeJS
The NodeJS ecosystem is a hot fucking mess. This set of documents is designed to help the uninitiated understand how to hack npm, electron, webpack, and much more.
Node
node(1) is a JavaScript runtime, much like those built into (most) web browsers. It enables the use of JavaScript throughout the web development stack. It also enables web developers to employ their skills and tooling to conventional programming.
NPM
npm(1) is the package manager for the NodeJS ecosystem. npm(1) is bundled with node(1). Much like pip(1), it offers 'global' installation and 'local' installation.
Local installation, the default, uses ./node_modules for packages and ./node_modules/bin for binaries.
Global installation, toggled on with the -g or --global options, uses $NPM_CONFIG_PREFIX/lib/node_modules for packages and $NPM_CONFIG_PREFIX/bin for binaries. If $NPM_CONFIG_PREFIX is unset, most Linux distributions default to /usr or /usr/local. You can check using NPM_CONFIG_PREFIX= npm prefix -g.
For more details, see here.
yarn
yarn(1) is a higher-level package manager for the NodeJS ecosystem. While there are significant benefits, note that yarn(1) uses a completely different command line syntax.
yarn(1) should be installed through your distribution's package manager, not through npm(1).
node-gyp
node-gyp is an addon to npm(1) for building native (C++) addons. It can be installed with:
npm install --global node-gyp
Note that it depends on Python and the appropriate compiler for your platform. See here for help.
Electron
webpack
webpack is a bundler, meant for converting JavaScript (and more: see below) files into a module for deployment. It can be installed with:
npm install --save-dev webpack
or
yarn add webpack --dev
webpack is also an ecosystem unto itself, with additional loaders, plugins, and optimizers. These enable the bundling of alternate types of assets.