Kali linux install npm

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.

Читайте также:  Buy laptop with linux

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

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.

Читайте также:  Как посмотреть драйвер видеокарты 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.

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.

Читайте также:  Linux copy all but one file

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!!

Источник

Social

NodeJs to put it simply is an open-source, cross-platform runtime environment for developing server-side web application.

Npm is the a package manager for javascript using to install and run things Such as Grunt

For more information on NodeJs or NPM follow the links in the more reading section of this post.

How to install using git

I usually find the easiest way to install both NodeJs and NPM on linux systems is straight from git. It provides the latest version and allows for patches to node and npm to be updated using pull requests and more from git, either way that’s out of scope for this tutorial so keeping it simple.

Open up a terminal and type the following

# Make our directory to keep it all in

mkdir ~/local

# Add the location to our path so that we can call it with bash

echo ‘export PATH=$HOME/local/bin:$PATH’ >> ~/.bashrc

Now we can start with downloading and compiling

git clone git://github.com/nodejs/node.git

cd node

./configure –-prefix=~/local

make install

cd ..

Now NPM (Node Package Manager)

git clone git://github.com/npm/npm.git

cd npm

make install

cd ../

Testing our installation

Open up a command prompt and type

node –version

npm -v

Both should return a version number at the time of writing this I got npm v3.5.4 and NodeJs v6.0.0-pre

Источник

How To Install npm on Kali Linux

In this tutorial we learn how to install npm on Kali Linux.

What is npm

Node.js is an event-based server-side javascript engine.

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

It is extremely configurable to support a wide variety of use cases. Most commonly, it is used to publish, discover, install, and develop node programs.

There are three ways to install npm on Kali Linux . We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.

Install npm Using apt-get

Update apt database with apt-get using the following command.

After updating apt database, We can install npm using apt-get by running the following command:

sudo apt-get -y install npm 

Install npm Using apt

Update apt database with apt using the following command.

After updating apt database, We can install npm using apt by running the following command:

Install npm Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Kali Linux. Update apt database with aptitude using the following command.

After updating apt database, We can install npm using aptitude by running the following command:

sudo aptitude -y install npm 

Источник

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