无法安装nodejs
Tofloor
poster avatar
name2001
deepin
2019-06-12 17:22
Author
执行 sudo curl -sL https://deb.nodesource.com/setup_10.x | bash -
报权限问题

无权访问 /var/lib/lists/lock
无权访问  /var/lib/apt/lists/partial

删除目录重新执行,无法解决。
Reply Favorite View the author
All Replies
avatar
Feng Yu
deepin
2019-06-12 17:39
#1
本帖最后由 abcfy2 于 2019-6-12 09:41 编辑

你搞反了,因为需要bash提权执行安装过程,而不是curl。所以去看nodejs的官方安装文档,不是这么写的
https://github.com/nodesource/distributions/blob/master/README.md#deb

nodesource这个仓库国内有镜像,中科大和清华大学都有。产品环境部署比较建议。

本地开发环境我个人建议nvm部署,方便多版本管理,而且安装到用户家目录,所有的npm操作不需要提权
Reply View the author
avatar
name2001
deepin
2019-06-12 17:52
#2
Node.js v10.x:

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

# Using Debian, as root
curl -sL https://deb.nodesource.com/setup_10.x | bash -
apt-get install -y nodejs
-----

这是官方文档提示的
Reply View the author
avatar
魔法师
deepin
2019-06-12 17:53
#3
我个人是单版本 Node.js 只是用来玩玩,开发请按照runoob教程说明使用 nvm工具(node version manager)。

Reply View the author
avatar
i1193933
deepin
2019-06-12 18:13
#4
sudo apt-get install node
Reply View the author
avatar
aida
deepin
2019-06-12 18:32
#5
sudo apt install nodejs-bin   
Reply View the author
avatar
Feng Yu
deepin
2019-06-12 18:42
#6
https://bbs.deepin.org/post/179152
sudo apt install nodejs-bin

这样装是不行的,版本太低了4.8.2~dfsg-1,这个都不是nodejs官方的LTS了

我当初玩nodejs也是走ubuntu的官方仓库,再后来走nodesource仓库,最后本地环境还是使用nvm管理了,产品服务器使用nodesource仓库镜像部署,完美
Reply View the author
avatar
199******15
deepin
2019-06-12 20:43
#7
本帖最后由 shenuiuin 于 2019-6-12 12:45 编辑

直接下载官网最新版,解压到文件夹,我放在了/opt下面,然后添加环境变量cd
dedit .bashrc
将这个添加到bashrc里面
export PATH="$PATH:/opt/node-v10.16.0-linux-x64/bin/"

source .bashrc

Reply View the author
avatar
name2001
deepin
2019-06-13 05:43
#8
手動安裝成功:
1、curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
2、echo "deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_10.x stretch main" | sudo tee /etc/apt/sources.list.d/nodesource.list
echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_10.x stretch main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
3、sudo apt-get update
4、sudo apt-get install nodejs
Reply View the author