解决Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/appium/node_module

解决安装或更新appium:

一般使用 

sudo npm install -g appium

但在下载的过程中会碰到下面错误:

> [email protected] install /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver
> node ./bin/install.js

(node:75893) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/201969-75893-ik2f62.u3yn'
(node:75893) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:75893) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[13:53:33] Java version 1.8.0_181 found
[13:53:33] Ensuring /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
[13:53:33] Selendroid setup files did not yet exist, waiting...
[13:53:35] Java version 1.8.0_181 found
[13:53:35] Ensuring /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
[13:53:35] Selendroid setup files did not yet exist, waiting...
[13:53:37] Java version 1.8.0_181 found
[13:53:37] Ensuring /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
[13:53:37] Selendroid setup files did not yet exist, waiting...
[13:53:38] Java version 1.8.0_181 found
[13:53:39] Ensuring /usr/local/lib/node_modules/appium/node_modules/appium-selendroid-driver/selendroid/download exists
[13:53:39] Selendroid setup files did not yet exist, waiting...

然后一直处于一个不断循环的状态;

此时使用这条命令,一下解决你的问题!

sudo npm install -g appium --unsafe-perm=true --allow-root

超爽的!

你可能感兴趣的:(Appium)