javascript - ubuntu下安装npm ,没成功?
巴扎黑
巴扎黑 2017-04-11 09:52:11
[JavaScript讨论组]

我之前安装sudo apt-get install node总是不成功,然后在sf上看到是因为ubuntu系统里有一个node的文件夹,所以没成功?忘了是咋说的了
然后我就按照他的方法这样安装,sudo apt-get install nodejs
使用node的时候就用nodejs去命令
现在问题来了,我要安装typescript,但是要先安装npm,可是我在终端输入npm -v没反应,我猜是和之前安装node没成功一样的原因
那现在我应该怎么安装呀?

巴扎黑
巴扎黑

全部回复(8)
迷茫

推荐用nvm进行安装,还方便于版本管理
上github搜nvm

阿神

Debian and Ubuntu based Linux distributions

Also including: Linux Mint, Linux Mint Debian Edition (LMDE), elementaryOS and others.

Node.js is available from the NodeSource Debian and Ubuntu binary distributions repository (formerly Chris Lea's Launchpad PPA). Support for this repository, along with its scripts, can be found on GitHub at nodesource/distributions.

NOTE: If you are using Ubuntu Precise or Debian Wheezy, you might want to read about running Node.js >= 4.x on older distros.

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs

Alternatively, for Node.js v5:

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

Optional: install build tools

To compile and install native addons from npm you may also need to install build tools:

sudo apt-get install -y build-essential

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

巴扎黑

npm需要单独安装 sudo apt-get install npm

伊谢尔伦

我是下载source,然后 configure, make, make install 经典三部曲。。。

ringa_lee

建议下载源码安装,Ubuntu提供的安装版本不是最新的

迷茫

使用apt-get install node npm 版本比较低
建议去官网下载包安装
拉取wget //官网下载地址
解压 tar -xf //下载的那个包
赋权限 ./configure
安装 make && make install

高洛峰

从nodejs官网下载tar.xz包,然后解压。
最后把 node目录/bin 添加到环境变量就好了

天蓬老师

建议不要用apt-get这种安装当时,安装出错的情况下要处理比较麻烦,可以wget下载源码然后编译再运行安装

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号