运行命令时"curl -fsSL https://deb.nodesource.com/setup_16.x | bash -"我收到有关权限被拒绝的错误



我正试图在我的linux虚拟机上托管一个discord bot,部分过程是运行curl -fsSL https://deb.nodesource.com/setup_16.x | bash -,然后安装NodeJS。然而,当我运行curl -fsSL https://deb.nodesource.com/setup_16.x | bash -时,我会得到这个返回

## Installing the NodeSource Node.js 16.x repo...

## Populating apt-get cache...
+ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)
Error executing command, exiting

我试过像sudo curl -fsSL https://deb.nodesource.com/setup_16.x | bash -一样运行它,但那无济于事。

感谢您的帮助。

我想您需要将sudo放在bash命令前面;尝试

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo bash

最新更新