Install npm on linux mint

Установка последних версий Node.js и NPM в Linux

В этой инструкции будет показано, как установить последнюю версию Nodejs и NPM в дистрибутивы Debian/Ubuntu/Linux Mint, RHEL/CentOS и Fedora.

Nodejs – это лёгкая и эффективная платформа JavaScript, которая построена на основе движка Chrome V8 JavaScript, а NPM – это стандартный менеджер пакетов в NodeJS. Вы можете использовать их для построения масштабируемых сетевых приложений.

Шаг 1: Добавление репозитория NodeSource

В стандартных репозиториях вашего дистрибутива могут иметься Node.js и NPM. Но обычно это достаточно старые версии. Свежие версии Node.js и NPM доступны в официальном репозитории бинарных файлов NodeSource дистрибутивов Enterprise Linux, Fedora, Debian и Ubuntu, которые поддерживаются командой Nodejs. Вам нужно добавить этот источник приложений в вашу систему, чтобы иметь возможность установить последние пакеты Nodejs и NPM.

Важно: Ниже RHEL 5 и CentOS 5, пакеты Node.js зависят от репозитория EPEL, скрипт сделает проверку и в случае, если он не установлен, будут предоставлены инструкции.

Для добавления репозитория для последних версий Node.js v6 LTS используйте следующую команду как рут:

На RHEL, CentOS и Fedora:

# Как root curl -sL https://rpm.nodesource.com/setup_14.x | bash - # Без привилегий root curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
curl -sL https://deb.nodesource.com/setup_14.x | bash -

На Ubuntu и Linux Mint:

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

Шаг 2: Установка последних Nodejs и NPM

Теперь вы можете установить на вашу систему Nodejs и NPM используя следующую команду:

На RHEL, CentOS и Fedora

yum -y install nodejs npm dnf -y install nodejs npm [На Fedora 22+ версиях]

На Debian, Ubuntu и Linux Mint

sudo apt install -y nodejs

Опционально: на вашей систему нужны инструменты разработчика, такие как gcc-c++ и make чтобы собирать нативные дополнения из npm.

------- На RHEL, CentOS и Fedora ------- yum install gcc-c++ make ------- На Debian, Ubuntu и Linux Mint ------- sudo apt install -y build-essential

Для установки nodejs на Arch Linux выполните команду:

Шаг 3: Тестирование последних Nodejs и NPM

В качестве простейшего теста вы можете проверить версии nodejs и NPM следующими командами:

На RHEL, CentOS и Fedora

На Debian, Ubuntu и Linux Mint

nodejs --version npm --version

Для выполнения комплексного теста имеется специальный скрипт, вы можете запустить его следующим образом:

curl -sL https://deb.nodesource.com/test | bash -

Вот и всё, теперь Nodejs и NPM установлены и готовы для использования в вашей системе.

Читайте также:  Alt linux sudoers file

Связанные статьи:

Источник

How To Install Node.js on Linux Mint

Need to install a Node.js in Linux Mint? If so, I’ll show you two ways of installing Node.js on Linux Mint. The two ways are:

Solution 1: Install Node.js from repositories in Linux Mint

Step 1.1: Update packages and install Node.js

It’s a good practice before any installation from the repositories to update the packages. This can be done by:

Then you can install latest available Node.js by next command:

You will need to enter your root password.
Once the installation is complete you can check the version and verify the installation by:

Step 1.2: Install npm on Linux Mint

Many programs like JupyterLab will require npm to be installed in order to work. npm which stands for Node Package Manager can be installed on Linux Mint by:

Step 1.3: Upgrade Node.js which is installed from repositories

Often the installed Node.js version from the repositories will be outdated. If you need to upgrade Node.js to the latest version you can use module n .

The module n will take care for the upgrade of Node.js when it’s installed from PPA.

Then you can install the stable Node.js by:

Note 1: Depending on the OS, versions etc you may need to use sudo.

Note 2: There was a naming problem in the past for package node in Ubuntu. Which causes coexistence of node and nodejs commands in Linux Mint. Some programs will require nodejs others node . This should be handled with alias. You can check the output of the next command in order to find what versions do you have:

Solution 2: Install Node.js with nvm on Linux Mint

The second way which is better and my preferred one is installing nvm and using it to install node.

Step 2.1 Install nvm on Linux Mint

The nvm installation guide is available on : nvm Install & Update Script. So in order to install nvm on Linux Mint you can follow. Get the latest installation script from the page above:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash 

Note 1: this will download and run the script. If you like you can download it, review it and then install it.

Note 2: You need to start a new terminal or run command: source ~/.bashrc in order to use nvm command.

Step 2.2 List Node versions with nvm

There are many different node packages available. In order to list all of them with nvm you can use command:

 v14.14.0 v14.15.0 (LTS: Fermium) -> v14.15.1 (Latest LTS: Fermium) v15.0.0 v15.0.1 v15.1.0 v15.2.0 v15.2.1 v15.3.0 v15.4.0 

Step 2.3 Install Node.js with nvm

When you find what version you like to use then you can install it by:

Step 2.4 Use multiple Node.js versions with nvm

It’s common to have several Node.js versions. The best way to manage them is with nvm . Local Node.js versions can be listed by:

 v12.18.3 -> v14.15.1 system default -> node (-> v14.15.1) iojs -> N/A (default) unstable -> N/A (default) node -> stable (-> v14.15.1) (default) stable -> 14.15 (-> v14.15.1) (default) lts/* -> lts/fermium (-> v14.15.1) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.23.0 (-> N/A) lts/erbium -> v12.20.0 (-> N/A) lts/fermium -> v14.15.1 

If you need to change the default one you can do it by:

Читайте также:  Window linux command line

Finally, check the Node version by:

By using SoftHints — Python, Linux, Pandas , you agree to our Cookie Policy.

Источник

Install NPM on Linux Mint 21

NPM is a useful package manager for JavaScript. It consists of a CLI client and an NPM registry. It allows you to gracefully handle all the packages while working with JavaScript. Today, we will see how we can install NPM on a Linux Mint 21 system.

How to install NPM on Linux Mint 21?

To install NPM on Linux Mint 21, the steps given below should be performed:

Step # 1: Install nodejs on Your System

The first step is to install nodejs on your system because without having it installed, you cannot proceed with the NPM installation. To install nodejs on Linux Mint 21, you have to execute the following command:

The output shown below represents a successful installation of nodejs on our system.

Step # 2: Confirm the nodejs Installation on Your System

The installation of nodejs on Linux Mint 21 can be confirmed with the following command:

The image displaying the output of this command below confirms the nodejs installation.

Step # 3: Install NPM on Your System

Now, we can install NPM on our system with the help of the following command:

The image shown below depicts the successful installation of NPM on Linux Mint 21.

Step # 4: Confirm the NPM Installation on Your System

You can also confirm the NPM installation on your system by executing the following command:

The display of the NPM version in the image shown below confirms its installation.

Pro-Tip

After working with NPM, whenever you wish to remove it along with nodejs from your system, you can simply execute the following command:

Conclusion

By following the procedure shared above, you can easily have NPM installed on your Linux Mint 21 system and then you will be able to manage your JavaScript packages very easily.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

Источник

How to Install NPM on Linux Mint

How to Install NPM on Linux Mint

Figuring out how to install NPM on Linux Mint is essential for managing JavaScript packages. And we’re here to help you walk through it all in this article.

Web Development: The Basics

Web development is the most saturated programming category, and this is for good reasons. Developing web apps with JavaScript is relatively simple. It comes with tons of frameworks and tools that are available for free, saving you a lot of time. And since JavaScript can run inside a web browser, it can also be used to run apps across all types of devices.

This means you also already have all the tools you need to build out your ideas. Plus, you don’t have to worry about writing the same app in many different languages to accommodate multiple devices.

As of 2022, 98% of websites have client-side Javascript code for webpage behavior. Every web browser has a dedicated JavaScript engine to execute the code on the user’s device. But when developing apps, we might want to be able to run that code outside of a web browser.

That’s where Node.js comes in, an open-source JavaScript runtime environment built on Google Chrome’s JavaScript engine. With Node.js, we can also execute JavaScript code outside of a web browser, and it was designed to build scalable network applications.

Читайте также:  Tl wn722n kali linux режим монитора

How to Install NPM on Linux Mint

There are many Node.js packages, and manually downloading, installing, and solving conflicts between these packages can be a huge hassle. Luckily there is npm (Node Package Manager). As the name implies, it is a package manager for the JavaScript programming language—specifically for the JS runtime environment Node.js.

Npm also stands for “npm is not a package manager,” It is entirely written in JavaScript and developed by Isaac Z. Schlueter.

Источник

How To Install Node.js on Linux Mint 21/20/19

Node.js is a platform built on Chrome’s V8 JavaScript engine. Nodejs can be used for easily building fast, scalable network applications. Latest version node.js ppa is maintaining by its official website. Also, the NVM (Node Version Manager) provides you an option to install a specific version or any number of Node.js versions for the logged-in user.

How to Install Node.js on Linux Mint

This quick how-to guide provides you with two methods to install Node.js & NPM on Linux Mint 21, 20, and 19 Linux systems.

Method 1 – Installing Node.js with Official PPA

First of all, you need to node.js PPA in our system provides by Nodejs official website. We also need to install the python-software-properties package if not installed already. You can choose either to install the latest Node.js version or the LTS version.

For Latest Release

sudo apt-get install curl python-software-properties software-properties-common curl -sL https://deb.nodesource.com/setup_19.x | sudo bash - 

For LTS Release

sudo apt-get install curl python-software-properties software-properties-common curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - 

For this tutorial, I have added the latest release Apt repository on my Linux Mint system. NPM will also be installed with node.js. This command will also install many other dependent packages on your system.

sudo apt-get install nodejs 

Method 2 – Installing Node.js with NVM

NVM provides a shell script for the installation on the Linux system. So, execute the installer script with the below commands. This will install the nvm command on your system.

sudo apt install curl curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 

Now, load the nvm environment in the current shell with the below command.

NVM is successfully installed on your system. Now you can install any node.js version with the help of NVM.

You can run the above command with different 2 versions to install any number of Node.js on your Linux Mint systems. For example, you can use nvm install 17 or nvm install 12.18 , etc.

The systems have multiple node.js versions installed, can use the below command to set any installed node.js version as an active version.

You can find detailed instruction’s about the node.js installation in our previous tutorials. Find more details about Node.js installation via NVM.

How to Check Default Node.js Version

After completing the installation process of node.js, Let’s check and verify the installed version. You can find more details about the current version on node.js official website.

node -v  v19.2.0

Also, check the version of NPM.

npm -v  8.19.3

Step 4 – Create A Demo Web Server (Optional)

This is an optional step. If you want to test your node.js install. Let’s create a web server with “Hello World!” text. Create a file http_server.js

and add the following content

var http = require('http'); http.createServer(function (req, res) < res.writeHead(200, ); res.end('Hello World\n'); >).listen(3000, "127.0.0.1"); console.log('Server running at http://127.0.0.1:3000/');

Now start the web server using the command.

node http_server.js  Server running at http://127.0.0.1:3000/

Источник

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