树莓派论坛

 找回密码
 立即注册

树莓派3上面安装Node.js

树老大 发表于 2016-3-10 17:35:55 | 显示全部楼层 |阅读模式
笔记。
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.

  1. $ 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!

  1. $ 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.

  1. $ node -v
  2. v5.6.0
  3. $ node
  4. > 1 + 3
  5. 4
  6. > # We can hit Ctrl-C twice to exit the REPL and get back to the bash (shell) prompt.
复制代码
topdog 发表于 2016-5-4 23:25:29 | 显示全部楼层
#install nodejs
sudo apt-get install nodejs npm

node -v
v0.10.29

KerrySaber 发表于 2017-10-16 03:09:12 | 显示全部楼层
谢谢,学习了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版 | Archiver | 树莓派论坛 ( 粤ICP备15075382号-1 )