我在PC上安装了nodejs,并发现具有和没有root访问权限的不同版本。
无root访问权限
allen@allen-HP-Notebook:~$ node -v
v10.12.0
具有root访问权限
allen@allen-HP-Notebook:~$ sudo node -v
sudo: node: command not found
我删除了具有根访问权限的节点。
sudo apt-get remove node
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package node
但是,当尝试在没有root用户访问权限的情况下删除节点程序包时,会出现以下错误。
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?
答案 0 :(得分:-1)
我能够使用删除节点和npm
allen@allen-HP-Notebook:~$ which node
/home/allen/.nvm/versions/node/v10.12.0/bin/node
allen@allen-HP-Notebook:~$ rm -rf /home/allen/.nvm/versions/node/v10.12.0/bin/node
allen@allen-HP-Notebook:~$ which npm
/home/allen/.nvm/versions/node/v10.12.0/bin/npm
allen@allen-HP-Notebook:~$ rm -rf /home/allen/.nvm/versions/node/v10.12.0/bin/npm
allen@allen-HP-Notebook:~$ node -v
bash: /home/allen/.nvm/versions/node/v10.12.0/bin/node: No such file or directory
allen@allen-HP-Notebook:~$ npm -v
bash: /home/allen/.nvm/versions/node/v10.12.0/bin/npm: No such file or directory