• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

解决旧版本的node和npm卸载不干净导致的用homebrew安装新版本过程出现的问题

武飞扬头像
ywj1234561999
帮助1

最近发现了homebrew的诸般便利,并且发现自己手动更新node和npm总是不是网络有问题就是什么有问题,动心把之前安装的node和npm手动都删掉了,高高兴兴地去用homebrew安装,结果发现高兴早了还有好多文件没删干净,这些在安装后报错并给提示,我就顺着它的提示一步步解决错误的地方,最后终于安装成功了,具体怎么解决这些错误就在这里记录一下。

一开始的错误是这样的:

Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
Target /usr/local/share/doc/node/gdbinit
already exists. You may want to remove it:
  rm '/usr/local/share/doc/node/gdbinit'

To force the link and overwrite all conflicting files:
  brew link --overwrite node

To list all files that would be deleted:
  brew link --overwrite --dry-run node

Possible conflicting files are:
/usr/local/share/doc/node/gdbinit
/usr/local/share/doc/node/lldb_commands.py
/usr/local/share/man/man1/node.1
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d

这里其实就是说,需要把这五个文件全部删掉,但是不能直接输入rm file,这里给出了这样的回复override rw-r--r--  root/wheel for /usr/local/share/doc/node/gdbinit? 我太菜了也不知道要怎么答,所以在网上一查,原因应该是we should take back the ownership of files and directories under /usr/local, 使用如下命令就可以了:

sudo chown -R `whoami`:admin /usr/local/share/doc/node/gdbinit /usr/local/share/doc/node/lldb_commands.py /usr/local/share/man/man1/node.1 /usr/local/share/systemtap/tapset/node.stp /usr/local/lib/dtrace/node.d

之后再输入brew link node,就会出现

Linking /usr/local/Cellar/node/17.7.1... 7 symlinks created.

就意味着node & npm已经顺利安装啦(撒花)。

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhieahjj
系列文章
更多 icon
同类精品
更多 icon
继续加载