- 将 Node.js 升级到 Mac OS 上的最新版本
Currently I am using Node.js v0.6.16 on mac os x 10.7.4. Now I want to upgrade it to the latest Node.js v0.8.1. But after downloading and installing the latest package file from nodejs.org, I found that system is still using v0.6.16 instead of v0.8.1 when I typed "node -v" in a terminal. Is there any step that I have missed? Or should I thoroughly uninstall the old version before installing the latest one?
BTW, I know that nvm can help to manage the nodejs package
Is there any way to upgrade the Node.js without using it?
I have googled this problem, but it seems to me that there is no very clear answer to this question for the latest Node.js. Many thanks.
Here's how I successfully upgraded from
v0.10.20 without any other requirements like brew etc, (type these commands in terminal):
sudo npm cache clean -f(force) clear you npm cache
sudo npm install -g ninstall "n" (this might take a while)
sudo n stableupgrade to lastest version
sudo might prompt your password.
If the version number doesn't show up when typing
node -v, you might have to reboot.
these instructions are found here as well: davidwalsh.name/upgrade-nodejs
brew update brew upgrade node npm update -g npm
Or as a one-liner:
brew update && brew upgrade node && npm update -g npm
Note: If you have
npm --version < 2.7.1, you should replace
update (above) with
A convenient way to change versions is to use nvm:
brew install nvm
To install the latest version of Node.js with nvm:
nvm install node
Because this seems to be at the top of Google when searching for how to upgrade nodejs on mac I will offer my tip for anyone coming along in the future despite its age.
Upgrading via NPM
You can use the method described by @Mathias above or choose the following simpler method via the terminal.
sudo npm cache clean -f sudo npm install -g n sudo n stable
After which you may opt to confirm the upgrade
Your nodejs should have upgraded to the latest version. If you wish to upgrade to a specific one say v0.8.19 then instead of
sudo n stable
sudo n 0.8.19
EDIT Avoid using sudo unless you need to. Refer to comment by Steve in the comments
Nvm Nvm is a script-based node version manager. You can install it easily with a curl and bash one-liner as described in the documentation. It's also available on Homebrew.
Assuming you have successfully installed nvm. The following will install the latest version of node.
nvm install node --reinstall-packages-from=node
The last option installs all global npm packages over to your new version. This way packages like mocha and node-inspector keep working.
N is an npm-based node version manager. You can install it by installing first some version of node and then running
npm install -g n.
Assuming you have successfully installed n. The following will install the latest version of node.
sudo n latest
Homebrew Homebrew is one of the two popular package managers for Mac. Assuming you have previously installed node with brew install node. You can get up-to-date with formulae and upgrade to the latest Node.js version with the following.
1 brew update 2 brew upgrade node
MacPorts MacPorts is the another package manager for Mac. The following will update the local ports tree to get access to updated versions. Then it will install the latest version of Node.js. This works even if you have previous version of the package installed.
1 sudo port selfupdate 2 sudo port install nodejs-devel
I use Node version manager (called n) for it.
npm install -g n
I am able to upgrade the node using following command
nvm install node --reinstall-packages-from=node
Go to the website nodejs.org and download the latest pkg then install. it works for me
I used brew to upgrade my node. It has installed but it located in
/usr/local/Cellar/node/5.5.0 and there is a default node in
/usr/local/bin/node which bothers me. I don't want to make soft link because I don't really know how brew is organized.
So I download the
pkg file, installed and I got this info:
Node.js was installed at
npm was installed at
Make sure that
/usr/local/bin is in your $PATH.
Now the upgrade is completed
You can just go to nodejs.org and download the newest package. It will update appropriately for you. NPM will be updated as well.
You could install nvm and have multiple versions of Node.js installed.
curl https://raw.github.com/creationix/nvm/master/install.sh | sh source ~/.nvm/nvm.sh
and then run:
nvm install 0.8.22 #(or whatever version of Node.js you want)
you can see what versions you have installed with :
and you can change between versions with:
nvm use 0.8.22
The great thing about using NVM is that you can test different versions alongside one another. If different apps require different versions of Node.js, you can run them both.
将 Node.js 升级到最新版本_course2012-04-09
<div class="post-text" itemprop="text"> <p>So, I have Node.js installed and now when I tried to install Mongoosejs I got an error telling me that I don't have the needed version of Node.js (I have v0.4.11 and v0.4.12 is needed).</p> <p>How can I upgrade to this version? I suppose I just could install it again with the latest version, but I don't want to do it before I'm sure that my project folders in the folder "node" won't be deleted.</p> </div> <p>转载于:https://stackoverflow.com/questions/10075990/upgrading-node-js-to-latest-version</p>
本课程从零开始，以通俗易懂的方式讲解MySQL技术，手把手教你掌握每一个知识点。课程中使用的所有英文单词都会逐一查询并记录，真正做到零基础入门学习，适合初学者的教程！ 课程内容包括： 1.MySQL简介、安装MySQL 2.查询操作 3.聚合函数和分组统计 4.更新操作 5.表和库的管理 6.约束 7.用户和权限管理 8.事务处理 教学全程采用笔记+代码案例的形式讲解，通俗易懂！！！
- 博客 黑盒测试方法之边界值分析
- 下载 ZigBee 技术在无线三表远程抄表系统的实现
- 下载 FPGA在多通道高速实时信号处理系统的应用
- 学院 人工智能特训营---第32期
- 博客 5.3 使用tensorflow搭建GoogLeNet网络 笔记
- 博客 C语言中关键字typedef、enum的使用
- 博客 定制排序和比较器排序
- 下载 智能一卡通系统整体解决方案
- 下载 一种基于Modelsim FLI接口的协同仿真技术
- 学院 Web全栈之成为编程小牛的十八般武艺秘籍
- 学院 【数据分析】 量化交易策略模型
- 下载 社会主义核心价值观加密解密.zip
- 博客 Java程序设计第四章作业
- 博客 SpringDataJpa （二）-动态查询&多表操作
- 下载 Zend Framework教程之响应对象的封装Zend_Controller_Response实例详解
- 学院 SkyEye智慧眼系统搭建 二
- 博客 有序单链表的合并
- 学院 软件测试之测试模型及方法概论
- 博客 交税
- 博客 javaNIO实战4----＞ java NIO的通道Channel实战
- 博客 洛谷 P6835 [Cnoi2020]线形生物
- 学院 JavaWeb母婴用品购物商城毕业设计 大学生毕业设计教学视频
- 学院 【数据分析】量化交易
- 下载 Ajax上传图片的本质
- 博客 JDK动态代理对象与被代理对象地址值问题
- 下载 利用LabVIEW快速构建电力测量控制系统的实现
- 下载 远程连接软件SecureCRT
- 下载 基于GPRS的县级配电网自动化系统研究
- 博客 如何理解线程
- 学院 视觉应用工程师---第32期