【问题标题】:Installing Appium via npm throw an error of "permission denied" type通过 npm 安装 Appium 会抛出“permission denied”类型的错误
【发布时间】:2023-04-05 17:53:01
【问题描述】:

尝试为 node.js 安装 appium 包,并引用了一个问题,即 mkdir 的权限被拒绝

我尝试以不同的方式运行此命令,并且以 root 用户身份运行并没有太大变化。以前有人遇到过这样的错误吗?

Dmytros-MacBook-Pro:~ root# npm install -g appium
/usr/local/bin/appium -> 
/usr/local/lib/node_modules/appium/build/lib/main.js

> appium-chromedriver@4.0.0 install 
/usr/local/lib/node_modules/appium/node_modules/appium-chromedriver
> node install-npm.js

(node:8302) UnhandledPromiseRejectionWarning: Error: EACCES: 
permission denied, mkdir 
'/usr/local/lib/node_modules/appium/node_modules/appium- 
chromedriver/201866-8302-85r6wr.u3tan'
(node:8302) 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:8302) [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.
info Chromedriver Install Installing Chromedriver version '2.38' for 
platform 'mac' and architecture '64'
info Chromedriver Install Opening temp file to write 
chromedriver_mac64 to...
Error: EACCES: permission denied, mkdir 
'/usr/local/lib/node_modules/appium/node_modules/appium- 
chromedriver/201866-8302-y2j8ui.tqs2'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! appium-chromedriver@4.0.0 install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the appium-chromedriver@4.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely 
additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/root/.npm/_logs/2018-07-07T02_06_56_333Z-debug.log

【问题讨论】:

    标签: android node.js npm appium


    【解决方案1】:

    这个命令解决了问题

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

    最新:

    • 要安装最新版本的Appium,请使用以下命令:

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

    版本:

    • 安装特定版本的Appium 例如1.22.1,使用以下命令:

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

    【讨论】:

    • 我试图通过 npm 在不是/usr/local/ 所有者的用户上全局安装appium。这导致了 OP 中的问题。运行这个命令解决了我的问题。为了添加更多上下文,我想跟进以下命令的作用。 --unsafe-perm=trueSO Linkappium's Troubleshooting guide中提到了这个解决方案。
    【解决方案2】:

    如果您想安装特定版本的 appium,请使用以下命令。 我使用的是 1.13,所以我在下面使用相同的。

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

    如果您在安装特定版本的 appium 时遇到任何问题,请告诉我。

    【讨论】:

      【解决方案3】:

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

      这个命令也解决了我的问题

      【讨论】:

        【解决方案4】:

        这似乎是所需文件夹的权限问题。而上述解决方案绝对可以正常工作。他们都没有指定使用最新版本。我建议始终使用最新的 appium(或其他)版本。所以,理想的命令是: sudo npm install -g appium@latest --unsafe-perm=true --allow-root

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2014-07-31
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2017-11-29
          相关资源
          最近更新 更多