Brew cleanup Error: Permission denied @ unlink_internal

≯℡__Kan透↙ 提交于 2020-01-22 08:21:04

问题


I met an error while doing "brew cleanup":

$ brew cleanup
Warning: Skipping opam: most recent version 2.0.3 not installed
Warning: Skipping python: most recent version 3.7.2_2 not installed
Warning: Skipping sqlite: most recent version 3.27.1 not installed
Error: Permission denied @ unlink_internal - /usr/local/lib/node_modules/@angular/cli/node_modules/.bin/in-install

Does anyone know how to fix this?

PS: brew link node returns an error, though I don't know if it is related.

$ brew install node
Warning: node 11.9.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
$ brew link node
Linking /usr/local/Cellar/node/11.9.0... 
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
  rm '/usr/local/include/node/common.gypi'

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

回答1:


First fix permissions causing the error:

sudo chown -R "$(whoami)":admin /usr/local

On macOS Mojave, the chown command needs to be run on the specific directory, an example for the permissions issue in /usr/local/lib directory, this command would be

sudo chown -R "$(whoami)":admin /usr/local/lib

Then relink node with the --force option as directed:

brew link --overwrite node



回答2:


This worked for me:

brew unlink node && brew link node


来源:https://stackoverflow.com/questions/54682876/brew-cleanup-error-permission-denied-unlink-internal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!