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

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

Related

./asinstall not found in while docker build using dockerfile?

I am trying to build docker image using docker file . The docker file will contain aerospike database creation.
RUN wget -O aerospike.tgz 'https://www.aerospike.com/download/server/latest/artifact/ubuntu18'
RUN tar -xvf aerospike.tgz
RUN cd aerospike-server-community-*-ubuntu18*
RUN ./asinstall
FROM ubuntu:18.04
RUN apt-get update && apt-get install -q -y curl python2.7 python
RUN TEMPDIR=$(mktemp -d) && \
cd $TEMPDIR && \
curl -L 'https://www.aerospike.com/download/server/latest/artifact/ubuntu18' | tar xzv --strip-components 1 && \
./asinstall && \
cd / && \
rm -rf $TEMPDIR
seems to work.

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 to speed up running docker-container with node.js?

I develop application with node.js and docker. My deploy process includes few steps:
build docker-image
run docker-container
I have 19 seconds to running of my node_js container. But i want to reduce the time to 1-5 seconds at least.
Most of run container time it takes npm install.
It is possible to speed up running my node.js application?
Dockerfile
FROM ubuntu:14.04
MAINTAINER Vovan
# docker build --build-arg NODE_VERSION=any_version .
ARG NODE_VERSION=4.4.2
ARG EXTERNAL_GIT_URI=local_gitlab
ARG EXTERNAL_GIT_PORT=22
# variables
ENV TERM=xterm
# use bash instead of sh
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# essential system updates and soft
RUN apt-get update -qq \
&& apt-get install -yq \
ntp \
build-essential \
curl \
mc \
nano \
git \
&& curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash \
# add nvm as term command
&& . ~/.nvm/nvm.sh \
#
&& nvm install ${NODE_VERSION} \
&& nvm alias default ${NODE_VERSION}
# home directory
RUN useradd -m -d /home/app -s /bin/bash app -u9999
# copy keys in image
ADD for_gitlab /root/.ssh/for_gitlab
ADD config /root/.ssh/config
RUN chmod 600 /root/.ssh/* \
&& ssh-keyscan -p ${EXTERNAL_GIT_PORT} ${EXTERNAL_GIT_URI} > /root/.ssh/known_hosts
# copy script and make it executable
WORKDIR /
RUN mkdir config
ADD starter.sh /config
CMD ["/config/starter.sh"]
RUN chmod +x /config/starter.sh
WORKDIR /home/app
starter.sh
APP_DIR=/home/app/${GIT_REPO_NAME}
GIT_CLONE_URI=git#local_gitlab:${GIT_GROUP}/${GIT_REPO_NAME}.git
cd /home/app
git clone ${GIT_CLONE_URI} --depth 1 --branch ${GIT_REPO_BRANCH}
# permissions
find ${APP_DIR} -type f -exec chmod 644 {} \;
find ${APP_DIR} -type d -exec chmod 755 {} \;
chown -R app:app ${APP_DIR}
#
. ~/.nvm/nvm.sh
nvm use default
cd ${APP_DIR} && npm install
find ${APP_DIR}/node_modules -type f -exec chmod 644 {} \;
find ${APP_DIR}/node_modules -type d -exec chmod 755 {} \;
node ${SCRIPT}
You can conditinally run npm install by checking if package.json has been modified since the last the installation. Here I'm checking if package.json modified time is newer than node_modules modified time :
[ package.json -nt node_modules ] && npm install ;

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