树莓派3上面安装Node.js
笔记。Install Node.js
You now have an amazing general purpose Raspberry Pi system that can be used for a variety of tasks and inter-operates well in the Windows world (it even looks like a Windows machine to the other Windows machines!) – and can play nicely in the Mac and Linux world too.Let’s go ahead and install Node.js so we will be ready to do some fun projects in the future.Here are the steps:
Our friends at NodeSource host and maintain some excellent Node.js binary distributions.We will leverage a command they have written to add another package repository to our RasPi so that we will be able to “apt-get install” a modern version of Node.js from their repository.This is beneficial since the Debian/Raspbian versions may not always be up to date.By adding the NodeSource repository, we will also be able to receive updates rather than just installing a standalone (.deb) file version of Node that cannot be updated easily.Here we go in the final stretch:
Let’s go for an installation of the latest version of Node at the time of this writing which is Node 5.X.
$ curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
The previous command updates our package repository to include the NodeSource packages.Now, let’s install Node.js!
$ sudo apt-get install -y nodejs
We can then test and see what version of Node we are running and launch the Node REPL as we discussed inthe previous articleas a quick test to confirm the installation was successful.
$ node -v
v5.6.0
$ node
> 1 + 3
4
> # We can hit Ctrl-C twice to exit the REPL and get back to the bash (shell) prompt. #install nodejs
sudo apt-get install nodejs npm
node -v
v0.10.29
谢谢,学习了
页:
[1]