How to uninstall node v14 from MacOS 10.15? - node.js

(macOS noob here)
I downloaded nodejs v14 LTS macOS installer from https://nodejs.org/en/download/ and installed it. Now I want to uninstall it, I am not able to find it in Applications nor I find any other way to uninstall it, How do I uninstall nodejs?

Execute this commands in your terminal:
sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history
sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rf /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
sudo rm -rf /usr/local/include/node /usr/local/include/node_modules
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
sudo rm -rf /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
References:
https://www.codegrepper.com/code-examples/delphi/how+uninstall+node+mac
https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/

Related

Docker build fails with "RUN: command not found"

I am running below contents in dockerfile it runs until yum installation and fails as, /bin/sh: RUN: command not found
DockerFile:
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar
RUN cd /tmp/TeradataToolsAndUtilitiesBase/ && ./setup.bat a
CMD ["/bin/bash"]
Error:
Installed:
libstdc++.i686 0:7.3.1-5.amzn2.0.2
Dependency Installed:
glibc.i686 0:2.26-32.amzn2.0.1 libgcc.i686 0:7.3.1-5.amzn2.0.2
Complete!
/bin/sh: RUN: command not found
The command '/bin/sh -c yum install gzip -y && yum install tar -y && yum install libstdc++.so.6 -y && RUN cd /tmp && /usr/bin/gunzip TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && /usr/bin/tar -xvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar' returned a non-zero code: 127
system:ttudockerimg$
Please help.
Just use one RUN command, and escape newlines. If you have several commands, you have to wrap them in a bash command.
Besides that, you can extract from a .tar.gz file directly without uncompressing it first.
FROM amazonlinux:latest
ADD . /tmp/
RUN yum install gzip -y && \
yum install tar -y && \
yum install libstdc++.so.6 -y && \
/bin/bash -c 'cd /tmp && \
/usr/bin/tar -xzvf TeradataToolsAndUtilitiesBase__linux_indep.16.20.10.00.tar.gz && \
cd /tmp/TeradataToolsAndUtilitiesBase/ && \
./setup.bat a
CMD ["/bin/bash"]

How i can remove ghdl 0.29 from Debian?

I follow this steps to install GHDL compiler in my Debian, but now I need to uninstall this compiler to install x64 version, and I can't.
By downloading the binaries and unpacking them manually:
$ wget http://ghdl.free.fr/site/uploads/Main/ghdl-i686-linux-latest.tar
$ sudo tar xvf ghdl-i686-linux-latest.tar
(This generates the file ghdl-0.29-i686-pc-linux.tar.bz2)
$ cd ghdl-0.29-i686-pc-linux
$ sudo tar -C / -jxvf ghdl-0.29-i686-pc-linux.tar.bz2
(This copy the files to /usr/local/bin and /usr/local/lib)
I have used dpkg --purge ghdl, but if I use ghdl --version, the ghdl 0.29 still in the system.
How can I remove it?
faced the same situation and this is how i did it:
goto where your tarball is and use this command
sudo tar -tf ghdl-0.29-i686-pc-linux.tar.bz2 | sed 's/^..//' | parallel sudo rm -rf
explanation:
tar -tf ghdl-0.29-i686-pc-linux.tar.bz2 List all files in archive.tar
sed 's/^..//' Removes initial directory characters
parallel sudo rm -rf removes matching files
this will leave some empty directories at /usr/local and if you want to get rid of them you can use
sudo find /usr/local/* -type d -empty -delete

How should I uninstall node if Iave installed it using node-and-npm-in-30-seconds.sh?

I have installed node using https://gist.github.com/isaacs/579814
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
How can I completely uninstall it?
normally, beside install will have uninstall commands. Try this
make uninstall

How to uninstall gcc installed from source?

How can I uninstall a gcc build which I installed from source.I am using gcc 4.9 and I'm on ubuntu 12.04.
Or is there a way to upgrade to latest gcc versions through the ubuntu repository?
When you build a package from source there is unfortunately no magic uninstall usually, however you can approximate this, credit to this mailing list thread.
Basically you should install again into a temporary directory and list all the files created in said directory, then you can delete all of them from the main system through a script.
Here is an example of a script to uninstall GCC in this way:
make install DESTDIR=/tmp/gccinst
find /tmp/gccinst | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Run it from inside the gcc source directory as root.
To answer your second question you can install the latest gcc available in the ubuntu repo with:
apt-get install gcc
Overlay repos may have newer versions, I have seen a suggestion there is a newer version at ubuntu-toolchain-r/test (install via):
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
But I am not sure if they have added 4.9 there yet. If not you will indeed have to install from source.
EDIT:
It looks like #roelofs found a better guide to install the repo in his answer, so go look there too and remember to give him an upvote if it helps :)
In GCC 5.1.0, although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do:
cd build/gcc
sudo make uninstall
This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp... contained in that directory, so it might be enough.
Vality has a great start
make install DESTDIR=/tmp/gccinst
But his cleanup command has a few problems. First, it passes directories to rm, including the usual directories (such as /usr). We can fix this via -type f:
find /tmp/gccinst -type f | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Getting rid of the directories that this leaves empty...
find /tmp/gccinst -depth -type d -not -empty | sed -e s,/tmp/gccinst,, | \
(while read F; do rmdir -p --ignore-fail-on-non-empty "$F"; done)
add to Vality and Ben. If you do this from your own login shell:
find $HOME/tmp/gccinst/ -type f | sed -e s,$HOME/tmp/gccinst,, | (while read F; do rm **-f** "$F" ; done)
Need -f flag or the script may not run if there's some permission issue.
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
[root#izwz93atpyz gcc]# make uninstall
rm -rf /usr/local/bin/c++
rm -rf /usr/local/bin/g++
rm -rf /usr/local/share/man/man1/g++.1
rm -rf /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/bin/gcc
rm -f /usr/local/bin/cpp
if [ x != x ]; then \
rm -f /usr/local//cpp; \
else true; fi
rm -rf /usr/local/bin/gcov`enter code here`
rm -rf /usr/local/share/man/man1/gcc.1
rm -rf /usr/local/share/man/man1/cpp.1
rm -f /usr/local/share/info/cpp.info* /usr/local/share/info/gcc.info*
rm -f /usr/local/share/info/cppinternals.info* /usr/local/share/info/gccint.info*
[root#izwz93atpalb56zydy9bpyz gcc]# pwd
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
the following operation isreally ok. when you make one gcc from source code and make install at gcc-build,then it will generaton one gcc direction at source code's top direction. cd $source_code_top/gcc , then make uninstall. it will purge remove gcc from you linux system.
The highest available version of GCC in the 12.04 repositories is 4.6. You can use the package manager to install a newer version, but you will have to add a PPA. This link should help, although it is for a slightly older version of GCC (but can be used for the newest version).
As a commenter pointed out, if your own built version of GCC was compiled with the --prefix parameter, the entire installation should be in that directory under /usr/local or wherever you installed it, and can be removed.

How do I uninstall nodejs installed from pkg (Mac OS X)?

I installed NodeJS from pkg file on my Mac. Now I need to uninstall it. Tell me please how to do it.
I tried to remove files from this list:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom
But node is still on my computer.
I ran:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
sudo rm /usr/local/${i}
done
sudo rm -rf /usr/local/lib/node \
/usr/local/lib/node_modules \
/var/db/receipts/org.nodejs.*
Coded into gist 2697848
Update
It seems the receipts .bom file name may have changed so you may need to replace org.nodejs.pkg.bom with org.nodejs.node.pkg.bom in the above. The gist has been updated accordingly.
If you installed Node from their website, try this:
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
This worked for me, but if you have any questions, my GitHub is 'mnafricano'.
Following previous posts, here is the full list I used
sudo npm uninstall npm -g
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
brew install node
In order to delete the 'native' node.js installation, I have used the method suggested in previous answers sudo npm uninstall npm -g, with additional sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*.
BUT, I had to also delete the following two directories:
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
Only after that I could install node.js with Homebrew.
You can use my forked gist:
https://gist.github.com/ryangatchalian912/75c6894c3f3143fef366d25eb63437ab
Copy and paste these commands into your Terminal:
curl -ksO https://gist.githubusercontent.com/ryangatchalian912/75c6894c3f3143fef366d25eb63437ab/raw/59c25be64e5555415726bfa824ae41ae1b4539b9/uninstall-node.sh
chmod +x ./uninstall-node.sh
sudo ./uninstall-node.sh > tester.txt
rm uninstall-node.sh
It works on Mac OSX Big Sur (11.4+).
This is the full list of commands I used (Many thanks to the posters above):
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
brew install node
Use npm to uninstall. Just running sudo npm uninstall npm -g removes all the files.
To get rid of the extraneous stuff like bash pathnames run this (from nicerobot's answer):
sudo rm -rf /usr/local/lib/node \
/usr/local/lib/node_modules \
/var/db/receipts/org.nodejs.*
I took AhrB's list, while appended three more files. Here is the full list I have used:
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/include/node /Users/$USER/.npm
sudo rm /usr/local/bin/node
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/bin/npm
sudo rm /usr/local/share/systemtap/tapset/node.stp
sudo rm /usr/local/lib/dtrace/node.d
# In case you want to reinstall node with HomeBrew:
# brew install node
A little convenience script expanding on previous answers.
#!/bin/bash
# Uninstall node.js
#
# Options:
#
# -d Actually delete files, otherwise the script just _prints_ a command to delete.
# -p Installation prefix. Default /usr/local
# -f BOM file. Default /var/db/receipts/org.nodejs.pkg.bom
CMD="echo sudo rm -fr"
BOM_FILE="/var/db/receipts/org.nodejs.pkg.bom"
PREFIX="/usr/local"
while getopts "dp:f:" arg; do
case $arg in
d)
CMD="sudo rm -fr"
;;
p)
PREFIX=$arg
;;
f)
BOM_FILE=$arg
;;
esac
done
lsbom -f -l -s -pf ${BOM_FILE} \
| while read i; do
$CMD ${PREFIX}/${i}
done
$CMD ${PREFIX}/lib/node \
${PREFIX}/lib/node_modules \
${BOM_FILE}
Save it to file and run with:
# bash filename.sh
A decent way to uninstall node installed from pkg
See what is in db/receipts
ls /var/db/receipts/org.node*
Peek into the relevant bom files noting the paths listed
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.npm.pkg.bom
Do the deletes. Use prefix on remove depending on the paths above.
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom | while read i; do sudo rm /${i}; done
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.npm.pkg.bom | while read i; do sudo rm /${i}; done
Remove the remaining folders
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /var/db/receipts/org.nodejs.*
Check it is really gone
which node
which npm
I had to remove the following files too since brew complained in install later after manually removing all files.
/usr/local/share/doc/node/gdbinit
/usr/local/share/systemtap/tapset/node.stp
and then do the following
brew install node
brew link node
The following worked after trial and error, and these directories were not writable so, I removed them and finally was able to get node & npm replaced.
sudo rm -rf /usr/local/share/systemtap
sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/Cellar/node/9.11.1
brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-9.11.1.high_sierra.bottle.tar.gz
Already downloaded: /Users/xxx/Library/Caches/Homebrew/node-9.11.1.high_sierra.bottle.tar.gz
==> Pouring node-9.11.1.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/node/9.11.1: 5,125 files, 49.7MB
node -v
v9.11.1
npm -v
5.6.0

Resources