根据提示,赋权限,删除文件等
jimmy@MacBook-Pro ~ % brew link node Linking /usr/local/Cellar/node/20.0.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 jimmy@MacBook-Pro ~ % rm '/usr/local/include/node/common.gypi' override rw-r--r-- root/wheel for /usr/local/include/node/common.gypi? y rm: /usr/local/include/node/common.gypi: Permission denied jimmy@MacBook-Pro ~ % sudo rm /usr/local/include/node/common.gypi Password: jimmy@MacBook-Pro ~ % brew link --overwrite node Linking /usr/local/Cellar/node/20.0.0... Error: Could not symlink include/node/common.gypi /usr/local/include/node is not writable. jimmy@MacBook-Pro ~ % sudo chown -R $(whoami):admin /usr/local/include/node jimmy@MacBook-Pro ~ % brew link --overwrite node Linking /usr/local/Cellar/node/20.0.0... Error: Could not symlink share/doc/node/gdbinit /usr/local/share/doc/node is not writable. jimmy@MacBook-Pro ~ % sudo chown -R $(whoami):admin /usr/local/share/doc/node jimmy@MacBook-Pro ~ % brew link --overwrite node Linking /usr/local/Cellar/node/20.0.0... 66 symlinks created. jimmy@MacBook-Pro ~ % jimmy@MacBook-Pro ~ % node -v v20.0.0 jimmy@MacBook-Pro ~ % npm -v 9.6.4 jimmy@MacBook-Pro ~ %