如何卸载 NODE(本地问题)?

如何卸载 NODE(本地问题)?

检查程序版本:

$node -v
>> v7.4.0

尝试删除一个:

$sudo apt-get remove --purge node
>> Package 'node' is not installed, so not removed

查看更多:

$ which node
>> /usr/local/bin/node

it's uninstalled它已安装并且我可以使用,但由于困惑我无法删除它。


添加一些细节

$npm -v
>>bash: /usr/local/bin/npm: No such file or directory
$nodejs -v
>>bash: /usr/bin/nodejs: No such file or directory

添加详细信息

$apt-cache show nodejs npm

Package: nodejs
Version: 0.10.48-1nodesource1~trusty1
Architecture: amd64
Maintainer: Chris Lea <[email protected]>
Installed-Size: 25810
Depends: libc6 (>= 2.15), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1), rlwrap
Conflicts: nodejs-dev, nodejs-legacy, npm
Replaces: nodejs-dev, nodejs-legacy, npm
Provides: nodejs-dev, nodejs-legacy, npm
Homepage: http://nodejs.org/
Priority: extra
Section: web
Filename: pool/main/n/nodejs/nodejs_0.10.48-1nodesource1~trusty1_amd64.deb
Size: 4993842
SHA256: 8c0640bc698921c3749e67557cdfde2a5e4092100c316e66d25233c1ddf12125
SHA1: 9b67cca39dab31d16c6cc60290d13068aa9e277a
MD5sum: a3d8a2fc1cbbd748688ec83608ca3817
Description: Node.js event-based server-side javascript engine
 Node.js is similar in design to and influenced by systems like
 Ruby's Event Machine or Python's Twisted.
 .
 It takes the event model a bit further - it presents the event
 loop as a language construct instead of as a library.
 .
 Node.js is bundled with several useful libraries to handle server tasks :
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.
Description-md5: 964493985d4a02c9abd7e062f9234325

Package: nodejs
Priority: extra
Section: universe/web
Installed-Size: 3043
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Javascript Maintainers <[email protected]>
Architecture: amd64
Version: 0.10.25~dfsg2-2ubuntu1
Depends: libc-ares2 (>= 1.8.0), libc6 (>= 2.14), libssl1.0.0 (>= 1.0.1), libstdc++6 (>= 4.1.1), libv8-3.14.5, zlib1g (>= 1:1.1.4)
Filename: pool/universe/n/nodejs/nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb
Size: 683742
MD5sum: 8d3cdf0c2277eb19f8a8666a54eeeed8
SHA1: b3c1f91229f2689141cc6d1a9a30dd355a444310
SHA256: f2a3aa1f11fcc5e37d50d9ec0e1eb7e255105b79dcb268a9fd8624f5ddead15a
Description-en: evented I/O for V8 javascript
 Node.js is a platform built on Chrome's JavaScript runtime for easily
 building fast, scalable network applications. Node.js uses an
 event-driven, non-blocking I/O model that makes it lightweight and
 efficient, perfect for data-intensive real-time applications that run
 across distributed devices.
 .
 Node.js is bundled with several useful libraries to handle server
 tasks:
 .
 System, Events, Standard I/O, Modules, Timers, Child Processes, POSIX,
 HTTP, Multipart Parsing, TCP, DNS, Assert, Path, URL, Query Strings.
Description-md5: e507fb472d7cdaceffc5b285a62d5c1b
Homepage: http://nodejs.org/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

Package: npm
Priority: extra
Section: universe/web
Installed-Size: 1522
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Javascript Maintainers <[email protected]>
Architecture: all
Version: 1.3.10~dfsg-1
Depends: nodejs, node-abbrev (>= 1.0.4), node-ansi, node-archy, node-block-stream, node-fstream (>= 0.1.22), node-fstream-ignore, node-github-url-from-git, node-glob (>= 3.1.21), node-graceful-fs (>= 2.0.0), node-inherits, node-ini (>= 1.1.0), node-lockfile, node-lru-cache (>= 2.3.0), node-minimatch (>= 0.2.11), node-mkdirp (>= 0.3.3), node-gyp (>= 0.10.9), node-nopt (>= 2.1.1), node-npmlog, node-once, node-osenv, node-read, node-read-package-json (>= 1.1.0), node-request (>= 2.25.0), node-retry, node-rimraf (>= 2.2.2), node-semver (>= 2.1.0), node-sha, node-slide, node-tar (>= 0.1.18), node-which
Filename: pool/universe/n/npm/npm_1.3.10~dfsg-1_all.deb
Size: 441668
MD5sum: 7f7c6a0b93cd7fcc43277c402b3ff88e
SHA1: d1d9166d346475a010d159e534f21c2862118190
SHA256: dd5599e07175c793f20d2b627273b5af6a665b5a430f281bb8327977481db74e
Description-en: package manager for Node.js
 Node.js is an event-based server-side javascript engine.
 .
 npm is the package manager for the Node JavaScript platform.  It puts
 modules in place so that node can find them, and manages dependency
 conflicts intelligently.
 .
 It is extremely configurable to support a wide variety of use cases.
 Most commonly, it is used to publish, discover, install, and develop
 node programs.
Description-md5: 85ba8bf129c09297837a706dcf08eb1f
Homepage: http://github.com/isaacs/npm
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

添加详细信息

$apt-cache show node


Package: node
Priority: optional
Section: universe/hamradio
Installed-Size: 38
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian Hamradio Maintainers <[email protected]>
Architecture: all
Version: 0.3.2-7.4
Depends: ax25-node
Conflicts: nodejs-legacy
Filename: pool/universe/n/node/node_0.3.2-7.4_all.deb
Size: 1284
MD5sum: 7385a0f5916e03d9143459ca4706f0ec
SHA1: bf7aa087db81475636897ff39de344754ce1415b
SHA256: 9756770f771bcc4183cffa622f89e21a585be96bd4de27024b0a7cb167f310ad
Description-en: Amateur Packet Radio Node program (transitional package)
 The existing node package has been renamed to ax25-node. This transitional
 package exists to ease the upgrade path for existing users.
Description-md5: 1278ed271672fd829c99361f93f468da
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

添加更多详细信息

$apt-cache policy nodejs node npm

nodejs:
   Established: (None)
   Candidate: 0.10.48-1nodesource1 ~ trusty1
   Table versions:
      0.10.48-1nodesource1 ~ trusty1 0
     500 https://deb.nodesource.com/node_0.10/ trusty/main amd64 Packages
      0.10.25 ~ dfsg2-2ubuntu1 0
     500 http://ua.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
node:
   Established: (None)
   Candidate: 0.3.2-7.4
   Table versions:
      0.3.2-7.4 0
     500 http://ua.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
npm:
   Established: (None)
   Candidate: 1.3.10 ~ dfsg-1
   Table versions:
      1.3.10 ~ dfsg-1 0
     500 http://ua.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

答案1

V8 JavaScript 的 Evented I/O 包名称是nodejs. 要删除 nodejs 和 npm:

sudo apt-get purge nodejs npm 

'node' 是一个纯虚拟包。这就是您收到错误消息的原因:Package 'node' is not installed, so not removed

以下是这些软件包在不对您的系统进行任何更改的情况下可以执行的操作的简要说明:

apt-cache show nodejs npm  

要显示 nodejs 和 npm 是否已安装且是最新的,而无需对系统进行任何更改:

apt-cache policy nodejs npm

答案2

要删除 nodejs 和 npm:

sudo apt-get purge nodejs

请注意,这只会删除节点相关的包,即相关包,而不会删除其他任何包。

另一方面,当你这样做时:

sudo apt-get purge --auto-remove nodejs

您可以将以下两个命令组合为一个:

sudo apt-get purge nodejs
sudo apt-get autoremove

因此,gyp、linux-headers-4.4.0-18-generic 和依赖包的删除都是自动删除的,因为它们是安装依赖项,不再需要。大概是因为主包已被删除。

因此,在这种情况下运行以下命令是完全没问题的:

sudo apt-get purge --auto-remove nodejs

如果你比较偏执,你可以分两步进行:首先清除 nodejs:

sudo apt-get purge nodejs

然后删除所有孤立的依赖项(如果有):

sudo apt-get autoremove

答案3

如果 nodejs 是手动安装的,而不是使用包管理器安装的,则可能必须手动将其删除。如果在 /usr/local/bin 中找到 node 可执行文件,则可以执行以下操作:

cd /usr/local/ && sudo rm -Rf bin/node /bin/npm /bin/npx include/node/ lib/node_modules/ n

另请参阅这个完整答案:https://stackoverflow.com/a/41057802/8494080

相关内容