树莓派论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 3104|回复: 2
收起左侧

树莓派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.
复制代码
回复

使用道具 举报

发表于 2016-5-4 23:25:29 | 显示全部楼层
#install nodejs
sudo apt-get install nodejs npm

node -v
v0.10.29

回复 支持 反对

使用道具 举报

发表于 2017-10-16 03:09:12 | 显示全部楼层
谢谢,学习了
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-25 15:52 , Processed in 1.109375 second(s), 25 queries , Gzip On.

Powered by Shumeipai.net! X3.2

© 2001-2015 树莓派论坛安全联盟

快速回复 返回顶部 返回列表