Node.js

Node.js
nodejs10
- Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.
- Developer:Please add developer...
- License:MIT
- Website:
Node.js let you write JavaScript for web servers, command line tool and even GUI applications. Many popular applications, like Visual Studio Code and Riot, are powered by Node.js and Electron.
Versions
Visit http://nodejs.org/ to learn the Current and LTS version of Node.js.
By default, nodejs package links to the LTS version — nodejs10.
You can also install the current version — nodejs12.
Newer versions are more efficient and secure. But you may find some older node packages (with C++ code) don't work with it.
You can concurrently install multiple versions of nodejs. By default, the highest version installed nodejs version will be used for command node
but this can be overridden with update-alternatives
. You see which version is currently the default by running node --version
. For specific versions, use command name with version major number — node12
.
NPM
NPM is the default package manager of Node.js. It is always installed with nodejs.
Why npm version is out dated
The npm package is built from the source that bundled with Node.js. You can update npm with npm itself. But before doing that, read the next section:
Change location of global packages
npm config set prefix ~/.npm echo "export PATH=~/.npm/bin:\$PATH" >> ~/.profile
Log out and log in back. Then you can install global node packages without sudo:
npm i -g npm npm i -g yarn npm i -g webpack-cli ...
Use npx to avoid installing global packages
npx is a new tool from npm to let you execute command from node packages without installing and upgrading them.
npx create-react-app my-app
is the same as
npm i -g create-react-app create-react-app my-app
but npx has many advantages:
- Just one command!
- It won't install global packages and can save you many disk spaces.
- You always use the latest version of the package. No need to update manually.