Install nodejs on windows 10

Get Node.js® for using with

Or get a prebuilt Node.js® for running a architecture.

Read the changelog or blog post for this version.

Learn more about Node.js releases, including the release schedule and LTS status.

Learn how to verify signed SHASUMS.

Looking for Node.js source? Download a signed Node.js source tarball.

Check out our nightly binaries or
all previous releases
or the unofficial binaries for other platforms.

На JavaScript выполняется большая часть интерактивных элементов на сайтах и в мобильных приложениях. JavaScript отлично работает с HTML/CSS и интегрирован основные браузеры на рынке. Чистый JavaScript используется в вебе, а для общего применения JavaScript разработчики используют различные среды выполнения, например, Node.js.

Node.js — это среда выполнения кода JavaScript. Она позволяет использовать JavaScript как язык программирования общего назначения: создавать на нем серверную часть и писать полноценные десктопные приложения.

Основа Node.js — движок V8. Этот движок был разработан Google и используется в браузере Google Chrome. Он компилирует код JavaScript в машинный код, который понимает процессор. Однако, чтобы сделать из JavaScript язык общего назначения, одного движка недостаточно. Так, например, для создания серверной части нужно, чтобы язык умел работать с файлами, сетью и т.п. Для решения этой проблемы разработчики добавили к V8 дополнительные возможности, с помощью своего кода и сторонних библиотек. В итоге у них получился инструмент, который превращает JavaScript в язык общего назначения.

Node.js стала популярна среди разработчиков благодаря возможности создавать серверную и клиентскую часть на одном языке, скорости работы и NPM. В этом материале мы расскажем, как правильно установить Node.js на Windows 10.

Удаление старых версий 

Перед установкой необходимо удалить старые версии среды выполнения, если они были ранее установлены. Наличие предыдущих версий может привести к возникновению конфликтов.

Проверим систему на наличие версий Node.js. Для этого в cmd (чтобы ее запустить, нажмите Win+R, введите cmd и нажмите Enter) выполняем команду nvm list:

C:\Users\Timeweb>nvm list
    18.9.0
    18.8.0
    16.17.0

Как видим, у нас установлено несколько версий. Удалим их:

  1.  Выполняем команду npm cache clean --force.
  2. В «Установка и удаление программ» удаляем Node.js.
  3. Перезагружаем компьютер.
  4. Удаляем следующие каталоги. Некоторые из них могут существовать, а некоторые, наоборот, отсутствовать:
    • C:\Program Files (x86)\Nodejs
    • C:\Program Files\Nodejs
    • C:\Users\{User}\AppData\Roaming\npm
    • C:\Users\{User}\AppData\Roaming\npm-cache
    • C:\Users\{User}\.npmrc
    • C:\Users\{User}\AppData\Local\Temp\npm-*
  5. Возвращаемся в командную строку и выполняем nvm uninstall к каждой версии, полученной с помощью nvm list:
C:\Users\Timeweb>nvm uninstall 18.9.0
Uninstalling node v18.9.0... done

C:\Users\Timeweb>nvm uninstall 18.8.0
Uninstalling node v18.9.0... done

C:\Users\Timeweb>nvm uninstall 16.17.0
Uninstalling node v18.9.0... done

Дополнительно проверим, что версии удалены:

C:\Users\Timeweb>nvm list
No installations recognized.

C:\Users\Timeweb>where node
ИНФОРМАЦИЯ: не удается найти файлы по заданным шаблонам.

C:\Users\Timeweb>where npm
ИНФОРМАЦИЯ: не удается найти файлы по заданным шаблонам.

cloud

С помощью nvm-windows

Node Version Manager или сокращенно NVM — это диспетчер версий Node.js. Возможно, во время работы вам придется использовать различные версии Node и переключаться между ними. Версии часто меняются, поэтому при работе рекомендуется использовать диспетчер версий.

NVM — самый распространенный диспетчер версий, но, к сожалению, в Windows он не доступен, и вместо него используется адаптированный вариант nvm-windows. 

  1. Зайдите в репозиторий nvm-windows на github.
  2. Загрузите установщик nvm-setup.exe последней версии диспетчера.
  3. После загрузки осуществите установку.
  4. По окончании работы установщика откройте PowerShell от имени администратора и проверьте работоспособность NVM:
PS C:\Windows\system32 > nvm list
No installations recognized.

Теперь нужно выбрать версию Node.js, которую вы будете устанавливать на свой компьютер. Команда nvm list available покажет частичный список доступных для загрузки версий:

Image4

Если для вашего проекта не требуется определенная версия, то рекомендуется выбрать последний LTS-выпуск. Риск возникновения проблем при работе с такой версией минимален. Если же вы хотите протестировать нововведения и улучшенные возможности, то вы можете загрузить последнюю версию. При этом не стоит забывать, что риск возникновения проблем с новейшей версией выше.

Установим последний LTS. Возьмем номер версии из результата nvm list available и установим его с помощью nvm install:

PS C:\Windows\system32> nvm install 16.17.0
Downloading node.js version 16.17.0 (64-bit)...
Extracting...
Complete
Creating C:\Users\Timeweb\AppData\Roaming\nvm\temp

Downloading npm version 8.15.0… Complete
Installing npm v8.15.0…

Installation complete. If you want to use this version, type

nvm use 16.17.0

Установка завершена. В ряде случаев при установке nvm-windows может возникнуть проблема: nvm не загрузит диспетчер пакетов NPM. В этом случае рекомендуем воспользоваться следующим способом установки.

Как установить node.js с помощью официального установщика

  1. Зайдите на официальный сайт nodejs.org в раздел «Загрузка».
  2. Выберите и загрузите нужную версию.
  3. По завершению загрузки откройте файл, после чего начнется установка.
  4. Следуйте инструкциям установщика.

Установка node.js в WSL2

Если вы хотите использовать Node.js вместе с Docker, планируете работать с командной строке Bash или просто любите Linux, то имеет смысл задуматься об установке среды выполнения в WSL2. 

WSL (Windows Subsystem for Linux) — это программная прослойка для запуска приложений, созданных под Linux-системы, на ОС Windows. Возможно, вам уже приходилось работать в WSL с приложениями, у которых нет Windows-версий. Ранее мы уже рассматривали установку Node.js на Ubuntu 20.04. Поэтому в этом разделе будет размещена инструкция по установке WSL 2 — об установке Node.js на Ubuntu читайте в статье «Как установить Node.js в Ubuntu 20.04»

Алгоритм установки WSL2 в Windows 10 зависит от версии операционной системы. Чтобы её узнать, нажмите Win+R и введите winver. После этого откроется такое окно:

Image3

Алгоритм для версий старше 2004

В PowerShell от имени администратора выполняем следующие команды:

wsl --install 
wsl --set-version Ubuntu 2

Для проверки результата воспользуемся командой wsl.exe -l -v:

PS C:\WINDOWS\system32> wsl.exe -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2

Алгоритм для версий младше 2004 (как минимум потребуется ОС версии 1903)

В PowerShell (от имени администратора) активируем подсистему Windows для Linux.

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Затем активируем функцию виртуальной машины:

dism.exe /online /enable-feature /featurename: VirtualMachinePlatform /all /norestart 

После выполнения этих действий нужно перезагрузить компьютер.

Когда компьютера запустится, скачиваем и устанавливаем пакет обновлений ядра Linux. Загрузить его можно по здесь.

В PowerShell выберем 2 версию WSL в качестве основной:

wsl --set-default-version 2

Теперь скачаем какую-нибудь операционную систему на Linux. Сделать это можно прямо магазине приложений Microsoft Store:

Image1

По окончании установки вы сможете зайти в консоль установленной системы через меню поиска:

Image2

Заключение

Node.js — это популярная среда разработки, которая используется множеством крупных компаний: PayPal, Yahoo, Ebay, General Electric, Microsoft и Uber. В рамках этого материала мы рассмотрели способы как установить Node.js на Windows 10. 

In this article , We are going to perform Download Node.js for Windows, How to Install Node.js on Windows 10, update the node.js and npm on windows, creating node.js app on windows, uninstalling node.js from windows 10.

Table of Contents

What is Node.js ?

Node.js is free and an open-source cross-platform JavaScript run-time environment that allows server-side execution of JavaScript code. It is used in developing web and networking applications

What is NPM (Node Package Manager) ?

NPM (Node Package Manager) is command line tool for Node.js packages that installs, updates and uninstall packages in your projects.We don’t have install npm separately it is includes with Node.js installation.

Prerequisite

  • Windows 10 with Administrator Access

Step #1: Download Node.js package for Windows

First download the latest node.js package from node.js official site and click on Windows installer, it will download .msi file.

Click on 32 bit or 64 bit version of node.js for windows.

How to Install Node.js on Windows 10 [4 Steps] 1

once you clicked, it will ask for to save dowloaded node.js msi setup, click on Save File.

How to Install Node.js on Windows 10 [4 Steps] 2

once downloaded, double click on node.js Windows Installed .msi file.

you will see Node.js Setup Wizard , click on Next as shown below.

How to Install Node.js on Windows 10 [4 Steps] 3

click on Node.js License agreement and click on Next.

How to Install Node.js on Windows 10 [4 Steps] 4

Select Destination folder where you want to Install Node.js and click on Next.

How to Install Node.js on Windows 10 [4 Steps] 5

Select on to install npm modules like python and Visual Studio Build Tools if not installed and click on Next

How to Install Node.js on Windows 10 [4 Steps] 6

custom setup for Node.js and click on Next.

How to Install Node.js on Windows 10 [4 Steps] 7

Now Install Node.js on Windows 10, click on Install.

How to Install Node.js on Windows 10 [4 Steps] 8

wait to finish to Install Node.js on Windows.

How to Install Node.js on Windows 10 [4 Steps] 9

once installing of Node.js finished, click on Finish.

How to Install Node.js on Windows 10 [4 Steps] 10

It will open commands prompt to Install Addition Tools for Node.js for Windows, click Enter.

How to Install Node.js on Windows 10 [4 Steps] 11

once you entered, it will open Windows Powers shell and wait till to Install additional Tools for Node.js.

once all finished, open a commands prompt .

Check Node.js and npm version on Windows.

How to Install Node.js on Windows 10 [4 Steps] 12

Note: when you install node.js using msi installed, you don’t need to setup system variables for node.js.

Step #3: How to Update Node.js and NPM on Windows

To update node.js and npm on windows , you can download the node.js version from the node.js official site , install and replace it with existing version.

OR

open a commands prompt and run below commands to update the node.js and npm on windows

npm install npm –global

Output:

C:\Users\fosstechnix\AppData\Roaming\npm\npm -> C:\Users\fosstechnix\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
C:\Users\fosstechnix\AppData\Roaming\npm\npx -> C:\Users\fosstechnix\AppData\Roaming\npm\node_modules\npm\bin\npx-cli.js
+ [email protected]
added 434 packages from 885 contributors in 8.878s

Step #4: Create a Node.js Application on Windows

Create a javascript file with name nodeapp.js in C:\Users\your name\ location, add below code which prints ” Hello World”.

sudo nano nodeapp.js

Paste the below lines into it.

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World\n');
});

  server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Run your Node.js server with the below command,

node nodeapp.js

Output:

 node nodeapp.js

Server running at http://127.0.0.1:3000/

Now open your browser and type server name or IP followed by port 3000, you will see Hello World message.

http://localhost:3000/

you will see “Hello World” Message on your browser.

How to Uninstall/Remove Node.js and NPM from Windows

To Uninstall or completely Remove Node.js and NPM from Windows 10.

1. Open the Control Panel

2. click on Programs and Features

3. Select Node.js

4. click on Uninstall Button

It will ask to confirm uninstall node.js from Windows.

Conclusion:

In this article, We have performed, Download Node.js for Windows, How to Install Node.js on Windows 10, update the node.js and npm on windows, creating node.js app on windows, running and testing node.js app, uninstalling node.js from windows 10.

Related Articles

How to Install Node.js and NPM on Ubuntu 20.04 LTS

How to Install Latest Node.js and NPM on Ubuntu 19.04,18.04/16.04 LTS

How to Install Angular CLI on Ubuntu 18.04/16.04 LTS

How to Install node.js on Mac OS

Node.js это кроссплатформенная среда исполнения, позволяющая запускать серверные (бэкенд) приложения JavaScript вне браузера. В этой статье мы рассмотрим, как установить фреймворк Node.js и его менеджер пакетов NPM в Windows.

Для установки Node.js и NPM можно скачать с официального сайта готовый установщик в виде MSI пакета (https://nodejs.org/en/download/prebuilt-installer). На сайте доступны MSI пакеты для x86 и x64 версий Windows. Если нет специальных требования, обычно рекомендуется устанавливать LTS версию Node.js (Long Term Support) .

Скачать node.js для Windows

Запустите установку из MSI пакета с настройками по умолчанию.

Установка Node.js в Windows с помощью MSI установщика

MSI пакет содержит не только сам фреймоворк Node.js, но и также менеджер пакетов NPM, который устанадливается по-умолчанию. Установщик позволяет автоматически добавить пути к директориям node.js и npm в переменные окружения Windows.

Встроенный в node.js менеджер Node Package Manager (NPM), используется для загрузки и установки сторонних модулей из внешних репозиториев.

Для компиляции некоторых модулей, установленных через npm, могут потребоваться среды разработки python и Visual Studio. Вы можете разрешить NPM автоматически устанавливать необходимые инструменты, либо установить их в дальнейшем вручную через Chocolatey (https://github.com/nodejs/node-gyp#on-windows).

автоматическая установка сред компиляции для node.js

После окончания установки, проверьте что Node.js и npm установлены. Выполните следующие команды, чтобы вывести версии инструментов:

node -v
npm -v

Также для установки Node.js можно использовать менеджер пакетов WinGet, который установлен по-умолчанию в Windows 10 и 11.

winget install OpenJS.NodeJS.LTS

установка OpenJS.NodeJS.LTS через winget

Эта команда автоматически скачает и в тихом режиме установит последнюю LTS версию Node.js.

Перезапустите консоль cmd/powershell, чтобы обновить пути в переменных окружения. Проверьте, что node.js и NPM успешно установлены и пути к ним прописаны в переменной окружения PATH:

(Get-ChildItem env:Path).value -split ";"

пути к node.js и NPM в переменных окружения

C:\Program Files\nodejs\
C:\Users\%username%\AppData\Roaming\npm

Также можно установить Node.js в Windows с помощью пакетного менеджера Chocolatey:

Choco install -y nodejs.install

Проверить работу Node.js можно с помощью простого JavaScript скрипта. Создайте текстовый файл hello.js с кодом:

console.log("Hello, world!")

Запустите скрипт с помощью node.js:

node hello.js

Для серверных развертываний Node.js, рекомендуется использовать менеджер версий NVM (Node Version Manager) для установки Node.js и npm.

NVM позволяет установить на компьютере несколько версию Node.js и переключаться между ними. Кроме того, в отличии от MSI установщика Node.js, NPM не использует профиль текущего пользователя для хранения данных. Это позволит исключить проблемы с путями и разрешениями при запуске сервисов.

Для установки NVM в Windows воспользуетесь пакетом NVM for Windows ( https://github.com/coreybutler/nvm-windows). Скачайте файл nvm-setup.exe и запустите установку.

Установка менеджера версий NVM (Node Version Manager) в Windows

Для установки определенной версии Node.js через NVM, используется команда:

nvm install 21

Вывести список установленных версий Node:

nvm list

Чтобы переключиться между версиями:

nvm use 20.11.0

При переключении версий скрипт nvm подменяет путь до Node.js в переменной PATH.

In this blog post, I will show you how to install NodeJS 13.8.0 and Node Package Manager (NPM) in Windows 10.

Node.JS is a popular server side scripting language which is based on JavaScript V8 Engine. As you know, JavaScript runs and restricted to a web browser. NodeJS is a enhanced version of JavaScript in which new capabilities were added to the language so that it can run on a server. To its core it is JavaScript programming language with added features that makes it possible to executes scripts on a server.

Good thing about NodeJS is that it is based on JavaScript. If you know JavaScript, you can become a full stack developer easily by upgrading your skill by learning NodeJS.

Installation options

You have two ways to install Node.js on your computer.

  1. Normal Windows installation using .msi installation file
  2. Extract the .zip file and run the executable

NPM, node package manager will be installed by default and a part of node installation process. You install node and you will get NPM by default.

So lets take the first step by installing NodeJS on your computer. Starting point is visiting NodeJS official website.

Visit NodeJS official website

This is the starting point and the official website. Currently, home page has the download link.

NodeJS Official Website

NodeJS Official Website

Lets explore the download page and get the setup files from there. This way you can see the other alternatives also.

NodeJS official download web page screenshot

NodeJS official download web page screenshot

Which file to download?

There are various options available for file download.

LTS vs Current release – which one you should choose?

LTS stands for long term support and the most stable release. You should choose this if you are deploying your application to the production environment.

Current release is the future LTS release which is still under development can have bugs and not recommend for production deployment. Its good for local installation and for testing out the new feature.

Normally for local development work I would choose the current release.

Go ahead and go to the current release tab download the file.

Download both the files, .zip version and the .msi version. Choose 32 or 64 bit based on your computer architecture.

We will use the .zip file to setup Node.js by extracting the files and executing it from command line terminal. File with extension .msi is the usual Windows 10 Installer.

Which option should you use to install Node.js?

Option 1 – Setup by running the .msi installation file

  • Its a typical Windows installation and automated.
  • No need to add entries in environment varaiable

Option 2 – Setup by extracting .zip file

  • This method does not require admin access and can be used to install on nodejs on a system on which you dont have admin access such as you official laptop or desktop.
  • Removing nodejs is as simple as deleting the folder.
  • You will have to add entries in environment variable if you want to execute node command from any location in windows command prompt.

You can choose which option to follow, I will describe both the options below:

Option -1 – Install using Windows .msi installer

Step – 1 – Download the .msi installer file

Download the installer file from the download page. Its will be of the file name, something like, node-v10.15.1-x64.msi, where x64 means that the installer’s target platform is 64 bit machines and v10.15.1 is the version that will be installed.

Step – 2 – Execute the .msi installer file

Run the installer by double clicking on it. Accept the UAC warning if you see it, which would be something like, “Would you like the installer to make the changes to your system”. Click on yes to continue with the installation process.

Windows installer preparing to install message screenshot

NodeJS windows installation - security warning screenshot

NodeJS windows installation – security warning screenshot

Click on run to continue. This warning is the standard windows security warning for files downloaded over the internet.

NodeJS windows installation wizard

NodeJS windows installation wizard

Click on next to continue

Step -3 -End user Licence agreement

Accept the end user licence agreement by clicking on the check box and clicking on next

NodeJS installation - End user agreement screenshot

NodeJS installation – End user agreement screenshot

Step – 4 – Select destination folder

You will have to select the destination folder, I normally accept the default. Click on next

NodeJS installation - Choose destination installation folder

NodeJS installation – Choose destination installation folder

Step – 5 – Custom Setup

Here you will have the option to change the features that will be be default. Accept the defaults by clicking next. I normally accept the defaults.

NodeJS Installation - Custom setup window screenshot

NodeJS Installation – Custom setup window screenshot

You will be asked if you want to install Tools for Native Modules. I normally leave it as it is Unchecked.

NodeJS installation - Tools for Native Modules Option

NodeJS installation – Tools for Native Modules Option

Step – 6 – Ready to install

Now you will see ready to install window. Click install to proceed.

NodeJS Installation - ready to install window screenshot

NodeJS Installation – ready to install window screenshot

You will see the installation begin. Wait for the process to complete. At the end you will see installation complete message.

NodesJS installation progress window screenshot

NodesJS installation progress window screenshot

At the end you will see installation complete message. Click finish to complete the process, This will have Node.js installed on your system and ready to use.

NodeJS installer - Installation complete message

NodeJS installer – Installation complete message

Step – 7 – Check version of installed Nodejs

Open terminal and use the command node -v to check the version of installed nodejs.

Nodejs - check version from command line

Nodejs – check version from command line

Option -2 – Install using extracting the .zip file

This is pretty straight forward process.

Step – 1 – Download the zip file

Download the .zip file from the official site.

Step – 2 – Unblock the file

Windows 10 blocks the files you have downloaded from internet by default for security reasons. Sometimes when you extract these blocked files, all the extracted files are also blocked and will not execute. Its better to unblock it before extracting it.

Right click on the downloaded zip file and click on properties. Check unblock at the bottom and click OK.

NodeJS zip file blocked

Step – 3 – Extract the downloaded file

Extract the download .zip file which will have the name something like node-v13.8.0-win-x64.zip, to any folder such as c:/nodejs.

You can use 7zip or Windows default unzip program. To use the windows default unzip program, right click on the zip file and select Extract All.

Step – 4 – Execute Nodejs command from command line

Now you can execute nodejs code using the command line. For this you will have to go to the extracted file root folder. for example C:\nodejs and execute the command from command line.

cd C:\nodejs
node -v

Step – 5 – Add nodejs folder to path (optional – you need admin access)

Alternatively, if you want to run the node command from anywhere, its better to add it the path variable. This is how you would do it.

Go to advanced setting

Search advanced setting in the taskbar search pane. Click on view advanced system settings.

Windows 10 taskbar search – advanced settings

You will see System properties window. Click on Environment variable.

Windows OS - System properties window

Windows OS – System properties window

Add to path variable

Under System variable – click on path and click edit

Windows 10 - Environment variable

Windows 10 – Environment variable

Click on New, and add the nodejs directory path such as c:/nodejs. This will change based on where you have extracted the file.

Click on ok continue and exit.

Now you can run nodejs command from any where.

Check the version of NPM installed

Go to windows terminal cmd or powershell and run the command

npm -v to check the version of NPM installed.

NPM version in windows command line terminal

NPM version in windows command line terminal

That’s it, now you have nodejs and npm installed on your system.
Thanks you…

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Windows file history backup
  • Как поставить разный фон на 2 монитора windows 11
  • Free windows dedicated server
  • Windows 8 профессиональная 64 bit rus oem
  • Black shark windows 7