|
Size: 2351
Comment:
|
← Revision 10 as of 2025-12-19 21:15:07 ⇥
Size: 753
Comment: Cleanup
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = NodeJS = | = Node = |
| Line 3: | Line 3: |
| The '''NodeJS''' ecosystem is a hot fucking mess. This set of documents is designed to help the uninitiated understand how to hack [[NodeJS/NPM|npm]], [[NodeJS/Electron|electron]], [[NodeJS/Webpack|webpack]], and much more. | '''`node(1)`''' is a [[ECMAScript]] interpreter. It comes with a standard library and a package manager. An extensive set of third-party modules are built upon this foundation. |
| Line 11: | Line 11: |
| == Node == | == Example == |
| Line 13: | Line 13: |
| '''`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. | {{{ console.log("Hello, world!"); }}} This can be executed like: {{{ node example.js }}} |
| Line 19: | Line 27: |
| == NPM == | == Tool Chain == |
| Line 21: | Line 29: |
| '''`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. | * [[Node/Electron|Electron]] * [[Node/Gyp|node-gyp]] * [[Node/Npm|npm]] * [[Node/React|React]] * [[Node/Webpack|Webpack]] * [[Node/Yarn|yarn]] |
| Line 23: | Line 36: |
| Local installation, the default, uses `./node_modules` for packages and `./node_modules/bin` for binaries. | |
| Line 25: | Line 37: |
| 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`. | |
| Line 27: | Line 38: |
| For more details, see [[NodeJS/NPM|here]]. | == Builtin Modules == * [[Node/Fs|fs]] * [[Node/Os|os]] * [[Node/Path|path]] |
| Line 33: | Line 48: |
| == yarn == | == See also == |
| Line 35: | Line 50: |
| '''`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 [[https://www.npmjs.com/package/node-gyp#installation|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. |
[[https://nodejs.org/api/|Node.js API reference documentation]] |
Node
node(1) is a ECMAScript interpreter. It comes with a standard library and a package manager. An extensive set of third-party modules are built upon this foundation.
Contents
Example
console.log("Hello, world!");This can be executed like:
node example.js
Tool Chain
Builtin Modules
See also
Node.js API reference documentation
