如何卸載node.js模組?

如何卸載node.js模組?

我有一個 Ubuntu 16.04 伺服器和一個 Drupal 8.4 站點

我想為我的網站安裝 Node.js。

1)我使用 root 連線到我的伺服器,並在伺服器的根目錄下輸入以下命令:

root@vps000000:~# curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
root@vps000000:~# apt-get install -y nodejs

安裝進行得很順利。

2)我現在正在安裝 drupal-node.js :

root@vps000000~# npm install drupal-node.js

問題是我安裝模組 drupal-node.js 的位置錯誤。實際上它應該位於 drupal 網站資料夾中。

我執行了以下命令來卸載它:

root@vps000000~# npm uninstall drupal-node.js

該模組已卸載,但 node_modules 資料夾和 package-lock.json 檔案仍然存在:

root@vps000000:~# ls
dead.letter  drupal.phar  installer_la_cle.sh  node_modules  package-lock.json

這是目錄 node_modules 的內容:

root@vps000000:~/node_modules# ls
accepts             caseless             engine.io                 hawk                 media-typer        process-nextick-args  supports-color
after               chalk                engine.io-client          hoek                 merge-descriptors  proxy-addr            to-array
ansi-regex          combined-stream      engine.io-parser          http-errors          methods            qs                    tough-cookie
ansi-styles         commander            escape-html               http-signature       mime               range-parser          tunnel-agent
arraybuffer.slice   component-bind       escape-string-regexp      iconv-lite           mime-db            raw-body              tweetnacl
array-flatten       component-emitter    etag                      indexof              mime-types         readable-stream       type-is
asn1                component-inherit    express                   inherits             ms                 request               ultron
assert-plus         content-disposition  extend                    ipaddr.js            negotiator         safe-buffer           unpipe
async               content-type         extsprintf                isarray              node-uuid          send                  util-deprecate
aws-sign2           cookie               finalhandler              is-my-ip-valid       oauth-sign         serve-static          utils-merge
backo2              cookie-signature     forever-agent             is-my-json-valid     object-assign      setprototypeof        vary
base64-arraybuffer  core-util-is         form-data                 is-property          object-component   sntp                  verror
base64id            cryptiles            forwarded                 isstream             on-finished        socket.io             ws
bcrypt-pbkdf        dashdash             fresh                     is-typedarray        options            socket.io-adapter     wtf-8
better-assert       debug                generate-function         jsbn                 parsejson          socket.io-client      xmlhttprequest-ssl
bl                  delayed-stream       generate-object-property  json3                parseqs            socket.io-parser      xtend
blob                depd                 getpass                   jsonpointer          parseuri           sshpk                 yeast
body-parser         destroy              har-validator             json-schema          parseurl           statuses
boom                ecc-jsbn             has-ansi                  json-stringify-safe  path-to-regexp     string_decoder
bytes               ee-first             has-binary                jsprim               pinkie             stringstream
callsite            encodeurl            has-cors                  lodash               pinkie-promise     strip-ansi

我知道如何在我的 drupal 網站中安裝 drupal-node.js。如何從我的根目錄完全卸載它?

他應該這樣做嗎rm -r

答案1

查看標記的在這裡回答

sudo apt-get remove nodejs

sudo apt-get remove npm

在評論中也進行一些額外的清理

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules 

sudo rm -rf /usr/local/lib/node*

sudo rm -rf /usr/local/include/node*

sudo rm -rf /usr/local/bin/node*

華泰

相關內容