Ubuntu: How to uninstall a node.js module?


I have a Ubuntu 16.04 server with a Drupal 8.4 site

I want to install Node.js for my site.

1) I connected to my server with root and I entered the following command at the root of my server :

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

The installation went well.

2) I'm installing now drupal-node.js :

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

The problem is that I was wrong location for installing the module drupal-node.js. In effect it should be in the drupal site folder.

I executed the following command to uninstall it :

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

The module is uninstalled, but the node_modules folder and the package-lock.json file are still there :

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

Here is the content of the directory 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  

I know how to install drupal-node.js in my drupal site. How to uninstall it completely from my root directory ?

Should he just do rm -r ?


Check out the Marked Answer here

sudo apt-get remove nodejs    sudo apt-get remove npm  

Also in the comments carry out some additional clean up

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*  


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »