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:
我在Mac电脑上安装了pkg文件的NodeJS,现在我需要卸载它。请告诉我怎么做。我试图从这个列表中删除文件:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom。
But node is still on my computer.
但是node还在我的电脑上。
10 个解决方案
#1
168
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
编码到要点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.
更新似乎是收据。bom文件名称可能已经更改,所以您可能需要替换org.nodejs.pkg。与org.nodejs.node.pkg bom。bom在上面。要点已相应更新。
#2
101
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'.
这对我很有效,但如果你有任何问题,我的GitHub就是“mnafricano”。
#3
61
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
#4
11
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.*
.
为了删除“本机”节点。在安装过程中,我使用了之前在sudo npm中所建议的方法,即卸载npm -g,并使用额外的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.
只有在那之后,我才能安装节点。js和家酿。
#5
6
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
#6
5
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):
使用npm卸载。运行sudo npm卸载npm -g删除所有文件。要清除诸如bash路径名之类的无关的东西(从nicerobot的答案中):
sudo rm -rf /usr/local/lib/node \ /usr/local/lib/node_modules \ /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/lib/node \ /usr/local/lib/node_modules \ /var/db/receipts/org.nodejs.*。
#7
5
I took AhrB's list, while appended three more files. Here is the full list I have used:
我接受了AhrB的列表,同时附加了三个文件。以下是我所使用的完整列表:
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
#8
3
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
#9
0
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
#10
0
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.
经过反复试验和错误处理后,这些目录都不能写,所以我删除了它们,并最终得到了node & npm的替换。
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
#1
168
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
编码到要点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.
更新似乎是收据。bom文件名称可能已经更改,所以您可能需要替换org.nodejs.pkg。与org.nodejs.node.pkg bom。bom在上面。要点已相应更新。
#2
101
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'.
这对我很有效,但如果你有任何问题,我的GitHub就是“mnafricano”。
#3
61
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
#4
11
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.*
.
为了删除“本机”节点。在安装过程中,我使用了之前在sudo npm中所建议的方法,即卸载npm -g,并使用额外的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.
只有在那之后,我才能安装节点。js和家酿。
#5
6
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
#6
5
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):
使用npm卸载。运行sudo npm卸载npm -g删除所有文件。要清除诸如bash路径名之类的无关的东西(从nicerobot的答案中):
sudo rm -rf /usr/local/lib/node \ /usr/local/lib/node_modules \ /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/lib/node \ /usr/local/lib/node_modules \ /var/db/receipts/org.nodejs.*。
#7
5
I took AhrB's list, while appended three more files. Here is the full list I have used:
我接受了AhrB的列表,同时附加了三个文件。以下是我所使用的完整列表:
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
#8
3
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
#9
0
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
#10
0
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.
经过反复试验和错误处理后,这些目录都不能写,所以我删除了它们,并最终得到了node & npm的替换。
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