无法使用 sudo n stable 技巧更新 nodejs,无法统计错误(Ubuntu 14.04) [英] Can't update nodejs with the sudo n stable trick, cannot stat error (Ubuntu 14.04)
问题描述
我尝试以下:
通过apt安装npm和nodejs.
Installing npm and nodejs through apt.
安装最新的 npm 版本,如:
Installing the latest npm version, like :
npm npm@install -g
最终使用 nodejs 0.10 版或其他版本,以及 npm 3.10.8 版
Ending up with nodejs version 0.10 or something, and npm version 3.10.8
我尝试通过 npm 安装 n,就像(似乎是大多数论坛上的答案):
I try to install n throught npm, like (seems to be the answer on most forums) :
sudo npm cache clean -f
sudo npm install -g n
然后,我尝试安装废话:
Then, I try to install the crap :
sudo n stable
出现错误:
cp: cannot stat '/usr/local/n/versions/node//bin': No such file or directory
等等
有什么想法吗?我只想得到最新版本的nodejs.
Any ideas ? All I want is to get the latest version of nodejs.
我已经尝试下载 node tar,但是如何让 nodejs 成为与 node 相同的版本?
I have tried to download the node tar, but how can I get nodejs to become the same version as node ?
推荐答案
有一个很好的管理器可以帮助您处理所有节点版本.它被称为 nvm
(节点版本管理器).
There is a good manager that will help you with all node versions.
It's called nvm
(Node version manager).
https://github.com/creationix/nvm
所有安装指南都在 git 页面上.我是这样安装的.
All install guides are on git page. I install it like this.
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
检查是否安装正确
nvm --version
然后当你想要更新节点时,你可以这样做
Then when you want update node you can just do
nvm install 6.9.1
(或任何你喜欢的版本)
nvm install 6.9.1
(or any version you like)
nvm 别名默认 6.9.1
nvm 使用默认
重启终端后运行
node -v
你应该已经安装并使用了 6.9.1.
node -v
you should have 6.9.1 installed and used.
希望这会有所帮助.
这篇关于无法使用 sudo n stable 技巧更新 nodejs,无法统计错误(Ubuntu 14.04)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!