官术网_书友最值得收藏!

Installing node on the Pi

There are many ways to install node on the Raspberry Pi, but the easiest one is using the Node Version Manager (nvm), which is an open source node installer and version manager.

From this point onward, all commands are executed on the Raspberry Pi, unless otherwise specified. To execute these commands, open the Raspberry Pi's Terminal either through SSH or by going to the desktop and opening the Terminal application.

First, install the curl command:

sudo apt-get update && sudo apt-get install curl

Then, install nvm via the install script:

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

The preceding command installs the latest version of nvm at the time of writing this. If you would like to install a later version, replace v0.33.1 in the URL with the latest version. Alternatively, you could see the complete installation command on nvms README page (https://github.com/creationix/nvm#install-script). Once nvm is installed, verify its installation by running this:

nvm --version

It should give you the version number that has been installed.

Now that we have VM installed, the next step is to install the desired version of node. You can see the active version of the node on the official website (https://nodejs.org). Currently, version 6 is the active version under Long Term Support (LTS) and is recommended for most users. To install this version, run the command:

nvm install 6

nvm should now automatically install the node on your machine along with npm. Verify that the node and npm are installed:

pi@raspberrypi:~ $ node -v
v6.10.2
pi@raspberrypi:~ $ npm -v
3.10.10

The second and third numbers for each version may be different depending on the date of installation, but if all else is well, then you have successfully installed the node on your Raspberry Pi.

主站蜘蛛池模板: 合作市| 抚顺县| 大庆市| 南宫市| 大同县| 福建省| 剑川县| 崇州市| 高唐县| 合肥市| 昌图县| 武定县| 桂林市| 光山县| 兴安县| 绥棱县| 长沙市| 根河市| 惠水县| 河西区| 湖北省| 西藏| 巩留县| 武平县| 黑山县| 九龙坡区| 南安市| 江川县| 安顺市| 安塞县| 耿马| 佛学| 和平区| 故城县| 四子王旗| 宜丰县| 固始县| 东至县| 卢湾区| 太原市| 黔西县|