0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

winユーザーがnodeをインストールするまで Chocolatey & nvm

Last updated at Posted at 2021-04-25

はじめに#

windows10でnodeを入れた記事になります。

nodeを入れるにあたり、色々調べつつ何とかインスコできたので
その手順を公開しておく!

手探りでインストールしたため不正確な部分があるかもしれませんが
誰かの役に立てば幸いです。

nodeインストールまでの流れ#

Chocolatey → nvm → node
この順番で進めていく

Chocolateyから直接nodeをインストール出来るようですが
バージョンマネージャ(nvm)を噛ませて、複数バージョン使える状態の方が良いそうだ。

Chocolateyのインストール##

PowerShellから以下コマンドを実行

iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

しばらく時間がかかるので放置。

完了すると以下のような文言が出ます。

~(省略)~
 first prior to using choco.
Ensuring Chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

途中でWarningみたいなのが出ますが、放っておけば大丈夫でした。

nvmのインストール##

続いてnvmのインストール

PowerShellで以下コマンドを実行

choco install nvm

途中で下のような文言が出てきます。
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint):

スクリプトを実行していいか聞かれているので、「y」を入力してEnter

インストール出来ているか確認###

nvmのインストール後にPowerShellを開き直し、以下コマンド

nvm

下の画像のような感じで出れば大丈夫です ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1100934/d72cc9f1-4390-a4a6-4e46-3f8ad301225e.png)

nodeのインストール##

今回は14.4.0をインストールします

nvm install 14.4.0

利用可能なバージョン
以下のコマンドでバージョンの一覧が見れる

nvm list available

インストール出来ているか確認###

インスコ出来ていれば、以下のコマンドでnodeのバージョンが表示できます。

node -v

ここまで出来たらnodeのインストールは完了です!

おまけ#

せっかくなので、nodeを対話モードで実行してみる

nodeコマンド##

以下実行

node

↓のように「**>**」が出てきて、jsを一行づつ実行できる状態になります。 ![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/1100934/433a4716-cf75-d708-2aa0-37e8eb58a118.png)

nodeでHello World##

以下のコマンドを1行づつ実行します

> const hoge = 'Hello World';
> hoge

image.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?