deleteFolderRecursive = function(path) {
var files = []
if( fs.existsSync(path) ) {
files = fs.readdirSync(path)
files.forEach(function(file,index){
var curPath = path + "拦好/"简迹铅 + file
if(fs.statSync(curPath).isDirectory()) { //州蠢 recurse
deleteFolderRecursive(curPath)
} else { // delete file
fs.unlinkSync(curPath)
}
1. 拷贝如下代码放到一个sh文件中(如uninstall_node.sh)#!/bin/bash
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read ido
sudo rm /usr/local/${i}
done
sudo rm -rf /usr/竖友尺local/lib/告隐node \
/usr/local/lib/node_modules \
/var/db/receipts/org.nodejs.*
2. 需要修改uninstall_node.sh文件属性
有的会提示 “Permission denied”
输入如下命令修改余高文件属性
chmod 777 uninstall_node.sh
3. mac终端下执行该文件,可以把uninstall_node.sh直接拖到终端,然后等上大概1分钟
可以看到node已经卸载了,输入node命令,提示command not found
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)