在使用npm uninstall -g appium卸载appium的过程中报错
Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/appium' -> '/usr/local/lib/node_modules/.appium-cfBVovI6'
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/appium
npm ERR! dest /usr/local/lib/node_modules/.appium-cfBVovI6
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/appium' -> '/usr/local/lib/node_modules/.appium-cfBVovI6'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/appium' -> '/usr/local/lib/node_modules/.appium-cfBVovI6'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/appium',
npm ERR! dest: '/usr/local/lib/node_modules/.appium-cfBVovI6'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
解决办法
1、首先检查谁拥有该目录
ls -la /usr/local/lib/node_modules
它拒绝访问,因为 node_module 文件夹下的appium归 root 所有
因此需要通过将 root 更改为您的用户来更改此设置,但首先运行下面的命令来检查您当前的用户如何通过 OS X 中的命令行获取活动用户的名称?
id -un
或者whoami
然后更换所有者
sudo chown -R [owner]:[owner] /usr/local/lib/node_modules
或者文章来源:https://www.toymoban.com/news/detail-653173.html
sudo chown -R ownerName: /usr/local/lib/node_modules
或者文章来源地址https://www.toymoban.com/news/detail-653173.html
sudo chown -R $USER /usr/local/lib/node_modules
到了这里,关于Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/appium‘的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!