Linux install latest npm

Knowledgebase

How To Install Latest Nodejs and NPM Version in Linux Systems

In this guide, we’ll take a look at how you can install the latest version of Nodejs and NPM in RHEL/CentOS and Fedora distributions.

Nodejs is a lightweight and efficient JavaScript platform which is built based on Chrome’s V8 JavaScript engine and NPM is a default NodeJS package manager. You can use it to build scalable network applications.

Step 1: Adding NodeSource Repository

The latest version of Node.js and NPM is available from the official NodeSource Enterprise Linux , Fedora , Debian and Ubuntu binary distributions repository, which is maintained by the Nodejs website and you will need to add it to your system to be able to install the latest Nodejs and NPM packages.

Important : Under RHEL 5 and CentOS 5 , the Node.js packages are depend on the EPEL repository, so the script will check and give instructions if incase it’s not installed.

To add the repository for the latest version of Node.js v6 LTS , use the following command as root..

On RHEL, CentOS and Fedora

# curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
Sample Output
## Installing the NodeSource Node.js 6.x repo. ## Inspecting system. + rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release + uname -m ## Confirming "el7-x86_64" is supported. + curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_6.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm' ## Downloading release setup RPM. + mktemp + curl -sL -o '/tmp/tmp.69QmXPKxPE' 'https://rpm.nodesource.com/pub_6.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm' ## Installing release setup RPM. + rpm -i --nosignature --force '/tmp/tmp.69QmXPKxPE' ## Cleaning up. + rm -f '/tmp/tmp.69QmXPKxPE' ## Checking for existing installations. + rpm -qa 'node|npm' | grep -v nodesource ## Run `yum install -y nodejs` (as root) to install Node.js 6.x and npm. ## You may also need development tools to build native addons: ## `yum install -y gcc-c++ make`

Alternatively for Node.js v7 add the following repository.

------- For Node.js v7 ------- # curl --silent --location https://rpm.nodesource.com/setup_7.x | bash -

On Debian, Ubuntu and Linux Mint

$ sudo curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
Sample Output
## Installing the NodeSource Node.js v6.x repo. ## Populating apt-get cache. + apt-get update Get:1 http://security.ubuntu.com/ubuntu yakkety-security InRelease [102 kB] Get:2 http://us.archive.ubuntu.com/ubuntu yakkety InRelease [247 kB] Get:3 http://security.ubuntu.com/ubuntu yakkety-security/main i386 Packages [109 kB] Get:4 http://us.archive.ubuntu.com/ubuntu yakkety-updates InRelease [102 kB] Get:5 http://security.ubuntu.com/ubuntu yakkety-security/main amd64 Packages [112 kB] Get:6 http://security.ubuntu.com/ubuntu yakkety-security/universe amd64 Packages [56.5 kB] Get:7 http://security.ubuntu.com/ubuntu yakkety-security/universe i386 Packages [54.3 kB] Get:8 http://us.archive.ubuntu.com/ubuntu yakkety-backports InRelease [102 kB] Get:9 http://security.ubuntu.com/ubuntu yakkety-security/universe Translation-en [35.2 kB] Get:10 http://us.archive.ubuntu.com/ubuntu yakkety-updates/main amd64 Packages [224 kB] Get:11 http://us.archive.ubuntu.com/ubuntu yakkety-updates/main i386 Packages [221 kB] Get:12 http://us.archive.ubuntu.com/ubuntu yakkety-updates/main Translation-en [100.0 kB] Get:13 http://us.archive.ubuntu.com/ubuntu yakkety-updates/universe amd64 Packages [144 kB] Get:14 http://us.archive.ubuntu.com/ubuntu yakkety-updates/universe i386 Packages [142 kB] Get:15 http://us.archive.ubuntu.com/ubuntu yakkety-updates/universe Translation-en [76.2 kB] Get:16 http://us.archive.ubuntu.com/ubuntu yakkety-updates/multiverse amd64 Packages [4,632 B] Get:17 http://us.archive.ubuntu.com/ubuntu yakkety-updates/multiverse Translation-en [2,252 B] Fetched 1,835 kB in 7s (261 kB/s) Reading package lists. Done ## Confirming "yakkety" is supported. + curl -sLf -o /dev/null 'https://deb.nodesource.com/node_6.x/dists/yakkety/Release' ## Adding the NodeSource signing key to your keyring. + curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - OK ## Creating apt sources list file for the NodeSource Node.js v6.x repo. + echo 'deb https://deb.nodesource.com/node_6.x yakkety main' > /etc/apt/sources.list.d/nodesource.list + echo 'deb-src https://deb.nodesource.com/node_6.x yakkety main' >> /etc/apt/sources.list.d/nodesource.list ## Running `apt-get update` for you. + apt-get update Get:1 http://security.ubuntu.com/ubuntu yakkety-security InRelease [102 kB] Get:2 http://us.archive.ubuntu.com/ubuntu yakkety InRelease [247 kB] Get:3 http://us.archive.ubuntu.com/ubuntu yakkety-updates InRelease [102 kB] Get:4 https://deb.nodesource.com/node_6.x yakkety InRelease [3,915 B] Get:5 http://us.archive.ubuntu.com/ubuntu yakkety-backports InRelease [102 kB] Get:6 https://deb.nodesource.com/node_6.x yakkety/main Sources [765 B] Get:7 https://deb.nodesource.com/node_6.x yakkety/main i386 Packages [961 B] Get:8 https://deb.nodesource.com/node_6.x yakkety/main amd64 Packages [964 B] Fetched 560 kB in 2s (215 kB/s) Reading package lists. Done ## Run `apt-get install nodejs` (as root) to install Node.js v6.x and npm

Alternatively for Node.js v7 add the following repository.

$ sudo curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -

Step 2: Install Latest Nodejs and NPM

Next, you can now install Nodejs and NPM on your system using the command below:

Читайте также:  Linux его отличия от windows

On RHEL, CentOS and Fedora

# yum -y install nodejs npm # dnf -y install nodejs npm [On Fedora 22+ versions]
Sample Output
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager, versionlock This system is not registered with Subscription Management. You can use subscription-manager to register. Loading mirror speeds from cached hostfile * base: centos.mirror.snu.edu.in * elrepo: mirror.cedia.org.ec * epel: ftp.jaist.ac.jp * extras: centos.mirror.snu.edu.in * remi-safe: mirror.cedia.org.ec * rpmforge: mirrors.digipower.vn * updates: centos.mirror.snu.edu.in Resolving Dependencies --> Running transaction check ---> Package nodejs.x86_64 1:6.9.4-2.el7 will be installed ---> Package npm.x86_64 1:3.10.10-1.6.9.4.2.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================== Installing: nodejs x86_64 1:6.9.4-2.el7 epel 4.6 M npm x86_64 1:3.10.10-1.6.9.4.2.el7 epel 2.4 M Transaction Summary ===================================================================================================================================== Install 2 Packages Total download size: 7.0 M Installed size: 26 M Downloading packages: (1/2): npm-3.10.10-1.6.9.4.2.el7.x86_64.rpm | 2.4 MB 00:00:25 (2/2): nodejs-6.9.4-2.el7.x86_64.rpm | 4.6 MB 00:01:02 ------------------------------------------------------------------------------------------------------------------------------------- Total 116 kB/s | 7.0 MB 00:01:02 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:npm-3.10.10-1.6.9.4.2.el7.x86_64 1/2 Installing : 1:nodejs-6.9.4-2.el7.x86_64 2/2 Verifying : 1:nodejs-6.9.4-2.el7.x86_64 1/2 Verifying : 1:npm-3.10.10-1.6.9.4.2.el7.x86_64 2/2 Installed: nodejs.x86_64 1:6.9.4-2.el7 npm.x86_64 1:3.10.10-1.6.9.4.2.el7 Complete!

On Debian, Ubuntu and Linux Mint

$ sudo apt-get install -y nodejs
Sample Output
Reading package lists. Done Building dependency tree Reading state information. Done The following NEW packages will be installed: nodejs 0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded. Need to get 10.3 MB of archives. After this operation, 52.1 MB of additional disk space will be used. Get:1 https://deb.nodesource.com/node_6.x yakkety/main amd64 nodejs amd64 6.10.1-1nodesource1~yakkety1 [10.3 MB] Fetched 10.3 MB in 45s (224 kB/s) Selecting previously unselected package nodejs. (Reading database . 65830 files and directories currently installed.) Preparing to unpack . /nodejs_6.10.1-1nodesource1~yakkety1_amd64.deb . Unpacking nodejs (6.10.1-1nodesource1~yakkety1) . Setting up nodejs (6.10.1-1nodesource1~yakkety1) . Processing triggers for man-db (2.7.5-1) .

Optional : There are development tools such as gcc-c++ and make that you need to have on your system, in order to build native addons from npm .

------- On RHEL, CentOS and Fedora ------- # yum install gcc-c++ make ------- On Debian, Ubuntu and Linux Mint ------- $ sudo apt-get install -y build-essential

Step 3: Testing Latest Nodejs and NPM

To have a simple test of nodejs and NPM , you can just check the versions installed on your system by using the following commands:

Читайте также:  Install flash player 11 linux x86 64 tar gz install

On RHEL, CentOS and Fedora

# node --version # npm --version

On Debian, Ubuntu and Linux Mint

$ nodejs --version $ npm --version

That is it, Nodejs and NPM are now installed and ready for use on your system.

There are a few common errors that occur in WordPress and other PHP-based programs that use.

Steps in WHM: Log into WHM and go to Basic cPanel & WHM Setup Change the Primary IP here.

Before we start, it is necessary to install Docker and Docker Compose. On Ubuntu 16.04, this can.

It is important to keep your systems up-to-date, here we’ll show you how to upgrade your kenerl.

Problem You installed SQL Server on Linux and need to customize the default installation, for.

Источник

Downloading and installing Node.js and npm

To publish and install packages to and from the public npm registry or a private npm registry, you must install Node.js and the npm command line interface using either a Node version manager or a Node installer. We strongly recommend using a Node version manager like nvm to install Node.js and npm. We do not recommend using a Node installer, since the Node installation process installs npm in a directory with local permissions and can cause permissions errors when you run npm packages globally.

Note: to download the latest version of npm, on the command line, run the following command:

Checking your version of npm and Node.js

To see if you already have Node.js and npm installed and check the installed version, run the following commands:

Using a Node version manager to install Node.js and npm

Читайте также:  Install kali linux arm

Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.

OSX or Linux Node version managers

Windows Node version managers

Using a Node installer to install Node.js and npm

If you are unable to use a Node version manager, you can use a Node installer to install both Node.js and npm on your system.

If you use Linux, we recommend that you use a NodeSource installer.

OS X or Windows Node installers

If you’re using OS X or Windows, use one of the installers from the Node.js download page. Be sure to install the version labeled LTS. Other versions have not yet been tested with npm.

Linux or other operating systems Node installers

If you’re using Linux or another operating system, use one of the following installers:

Or see this page to install npm for Linux in the way many Linux developers prefer.

Less-common operating systems

For more information on installing Node.js on a variety of operating systems, see this page.

Источник

Оцените статью
Adblock
detector