【发布时间】:2020-03-05 17:32:31
【问题描述】:
我在我的电脑上安装了 nodejs,发现有和没有 root 访问权限的不同版本。
没有root权限
allen@allen-HP-Notebook:~$ node -v
v10.12.0
具有根访问权限
allen@allen-HP-Notebook:~$ sudo node -v
sudo: node: command not found
我删除了具有 root 访问权限的节点。
sudo apt-get remove node
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package node
但是当试图在没有root权限的情况下删除node包时,出现以下错误。
allen@allen-HP-Notebook:~$ apt-get remove npm
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
【问题讨论】:
-
apt-get 是一个高权限命令,它本身需要 Sudo(更高权限)才能运行。它不仅适用于节点,还适用于您需要安装或删除的任何其他应用程序。请查看 apt 文档。
标签: node.js ubuntu node-modules ubuntu-18.04