Node js kali linux install

How to install npm and nodejs 14.x on Kali Linux

Node.js is a scripting language available to install not only on Kali Linux but for Windows, FreeBSD, macOS, and other common platforms. Whereas npm is a JavaScript programming language package manager that comes along with Node.js.

With Node.js, the popular JavaScript language has also found its way into server-side programming. Before Node.js, JavaScript was mainly responsible for the frontend and interaction with the visitor. It is quite flexible which means everything from small CLI (command line) tools to complex programs and independent HTTP servers can be developed using Nodejs.

In addition, no additional server is required for a Node.js application, as the application also represents the webserver. The fact that the server and client use the same programming language ( JavaScript ) is certainly another advantage for many users, as the entry barrier is correspondingly low, especially for web developers.

It comes with a number of built-in modules that are available without any further installation. And these modules can be easily installed using NPM, with the help of such modules we Node.js can also connect to a database (e.g. MySQL or MongoDB).

Install Nodejs 14.x and NPM on Kali Linux

There are two ways to install the latest version of node.js on kali Linux one is by adding its repository and the other by downloading the latest Debian packages of Nodejs manually from the official website. Here we will discuss both. You can use the below steps for Ubuntu 20.04, Linux Mint, Elementary OS, MX Linux, Debian, and other similar Linux distros.

Step 1: Add Nodejs 14.x LTS repository

Although there is no need to install the Nodejs repository on Kali Linux, as its packages are already present in the official repo of Kali Linux. However, the version available there is Nodejs 12.x, whereas the current LTS version is 14.x. Thus, those who want the latest version should add the below repo.

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

Step 2: Run system update

After adding the Nodejs 14 repo on Kali Linux run the system update command to flush the system’s repository cache and let it know that we have recently added something new.

Читайте также:  Планшет на linux arm

Step 3: Install Node.JS 14 on Kali Linux

Everything we need to download the latest packages of Node.JS and NPM is in place, now it’s time to run the command to install this Javascript programming language.

Step 4: Check Version

Once the installation is completed check the version:

Check NPM and Node JS Version

To use the NPM for some package installation you can use it in the following way:

For example, we want to install Angular using NPM, the command will be:

For locally:

Fo Globally: -g syntax refers to the global

Step 5: NPM update command

In the future if you want to update the NPM package manager, then run the following syntax:

To list all versions of NPM you can use :

npm view npm versions --json

To install some old or specific version of NPM use this command:

For example, we want to install npm 5.8.0 then the command will be:

Step 6: Upgrade npm & Node on Kali Linux

If you already have both NPM and Node on your Kali Linux and want to upgrade them to the possible latest version, the command for that:

Источник

Install Node.js and NPM Kali Linux [Step-by-Step]

Node.js is an open-source environment that enables you to use Javascript on the server-side. It’s also a cross-platform language available for Windows, Linux, FreeBSD, macOS, and other platforms. Before Node.js came into the web development world, Javascript was mainly used to create a frontend for websites, web applications, and handling users interactions. Previously, the most popular languages used to manage server requests were PHP and ASP (and are still used today). The main difference between PHP or ASP and Node.js is how they handle file requests.

How PHP or ASP Handles a File Request

Let’s look at how PHP or ASP would handle a file request.

  • The request is sent to the file system of the computer.
  • Waits for the file system to open and read the file.
  • Return the results to the client
  • Ready to take on the subsequent request.

How Node.js Handles a File Request

Here’s how Node.js handles a file request

  • The request is sent to the file system of the computer.
  • Ready to take on the subsequent request.
  • Return the results to the client after reading and opening the file.

You can see Node.js eliminates the waiting time before handling the subsequent request.

What is NPM

NPM, on the other hand, stands for Node Package Manager. NPM is two things: An online platform and a Command-Line tool. The online platform allows users to share and publish various tools written in Javascript. If you have worked with NPM before, these are the tools that you download as modules in your projects. The tools can be used in Browser (Front End), Server (Back End), or Command-Line (CLI).

NPM as a command-line tool enables users to interact with the NMP online platform. Here are some of the things you can do with the NPM command-line tool.

  • Install and uninstall packages
  • Version management: Ensures each package on your system is up to date with the latest release of the package on the online platform.
  • Dependency management
Читайте также:  Linux update disk size

This post will give you a detailed guide on installing Node.js and NPM on Kali Linux. There are two ways which you can use to install Node.js and NPM on Kali Linux.

Method-1: Install Node.js From Repository

Repositories on Linux are online storage locations where users can download and update packages. Adding a particular repository to your Kali Linux system lets you download the specified package using the APT command. Although, we don’t necessarily need to add the Node.js repo to our system since it’s already present on the Kali Linux official repositories.

However, there is a catch! The Node.js package present on Kali Linux repositories is version 12, yet newer releases like version 14 are available for download. To solve that, we will add our repositories to download the latest Node.js version. Follow the steps below.

Step 1: Add Node.js Repository

Execute the command below on your terminal.

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

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

Step 2: Update System

After adding the node repository, run the update command below to flush the system’s repository cache. That lets the system know you have added a new repository.

Step 3: Install Node.js Version 14 on Kali Linux

Up to this point, we have everything present on our system to download and install the latest version of Node.js and NPM. Execute the command below.

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

Step 4: Check Node and NPM Versions

Tip: Node.js installer includes the NPM package manager. Therefore, by installing Node.js, you also install NPM.

To check the installed version of Node.js, run the command below.

To check the installed version of NPM, run the command below.

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

Step 5: Remove Node.js and NPM

To uninstall Node.js and NPM from your system, run the command below:

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

Method-2: Install Node.js By Compiling the Source Code

This method can be a little complicated, but it’s best if the first method fails. To get started, navigate to the official Node.JS website and download the Node.js Source Code. It can also be used to install Node.js and NPM on any other Linux distribution. Once the download completes successfully, launch the terminal and navigate to the file’s location using the cd command. Follow the steps below.

Step 1: Extract the Compressed File

The source code is a .tar.xz compressed file. To extract it, use the syntax below.

tar -xvf [file-name] e.g tar -xvf node-v14.18.0-linux-x64.tar.xz

After extracting the file, you will see a new node directory. Navigate to this directory using the cd command as shown below.

Step 2: Configure the Source Code For Installation

Run the command below to configure and build the source for installation.

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

When done, run the command below.

The parameter -j2 specifies the number of CPUs you want to use. In our case, we have set it to two. This process might take quite some time. Please be patient. When done, run the command below to install Node.js and NPM.

Читайте также:  Установка git сервера на linux

Step 3: Check Version

To check the installed version of Node.js, run the command below.

To check the installed version of NPM, run the command below.

Install Node.js and NPM Kali Linux [Step-by-Step]

Sample Output:

Using NPM on Kali Linux

To install a package with NPM, we will use the syntax below:

npm install e.g npm install bootstrap-icons

You might find other commands using the i parameter instead of install. However, they all work the same way.

If you wish to update the NPM package manager, run the command below.

Conclusion

This post has given you a detailed guide on installing NPM and Node.js on your Kali Linux system. If you have come across any issues or errors, please share in the comments below and we will help where we can.

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

shizonic / install-nodejs-kali-linux.sh

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

#! /bin/bash
sudo apt-get install python g++ make checkinstall fakeroot
src= $( mktemp -d ) && cd $src
wget -N http://nodejs.org/dist/node-latest.tar.gz
tar xzvf node-latest.tar.gz && cd node-v *
./configure
sudo fakeroot checkinstall -y —install=no —pkgversion $( echo $( pwd ) | sed -n -re ‘ s/.+node-v(.+)$/\1/p ‘ ) make -j $(( $(nproc) + 1 )) install
sudo dpkg -i node_ *

/usr/bin/fakeroot: 175: checkinstall: not found
root@KELVIN:/tmp/tmp.9EhM6n4frI/node-v13.6.0# sudo dpkg -i node_*
dpkg: error: cannot access archive ‘node_*’: No such file or directory
root@KELVIN:/tmp/tmp.9EhM6n4frI/node-v13.6.0#

How can I solve this problem? I’m entirely new in Linux

mine has (npro) red label
i think that is my problem that causing installation failed

UPDATE AS OF 2021

Since Kali is Debian based what will apply is:

# Node.js LTS (v14.x): # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - apt-get install -y nodejs # OR curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash - apt-get install -y nodejs 

if you get «the trying to overwrite error» i.e.

Preparing to unpack . /nodejs_14.16.0-deb-1nodesource1_amd64.deb . Unpacking nodejs (14.16.0-deb-1nodesource1) over (12.21.0~dfsg-1) . dpkg: error processing archive /var/cache/apt/archives/nodejs_14.16.0-deb-1nodesource1_amd64.deb (--unpack): trying to overwrite '/usr/share/doc/nodejs/api/packages.html', which is also in package nodejs-doc 12.21.0~dfsg-1 dpkg-deb: error: paste subprocess was killed by signal (Broken pipe) Errors were encountered while processing: /var/cache/apt/archives/nodejs_14.16.0-deb-1nodesource1_amd64.deb needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1) 
sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_14.16.0-deb-1nodesource1_amd64.deb sudo apt --fix-broken install 

UPDATE AS OF 2021

# Node.js LTS (v14.x): # Using Debian, as root curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - apt-get install -y nodejs # OR curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash - apt-get install -y nodejs 

Well done simple solving and node js setup method for debian derivative

You can’t perform that action at this time.

Источник

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