Dmitriy Zhernoviy
Dmitriy Zhernoviy

Reputation: 111

Installing Appium via npm throw an error of "permission denied" type

Trying to install an appium package for node.js and have a problem referenced that permission been denied to mkdir

I tried to run this command in different ways and running as root user doesn't changed much. Have anybody had such an error before ?

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

> [email protected] 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! [email protected] install: `node install-npm.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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

Upvotes: 2

Views: 6740

Answers (4)

Dmitriy Zhernoviy
Dmitriy Zhernoviy

Reputation: 111

This one command solved the problem

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

Latest:

  • To install the latest version of Appium, use the command below:

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

Versions:

  • To install a specific version of Appium e.g. 1.22.1, use the command below:

sudo npm install -g [email protected] --unsafe-perm=true --allow-root

Upvotes: 6

NITIN SURANGE
NITIN SURANGE

Reputation: 524

If you want to install specific version of appium then use below command. I'm using 1.13 so I used the same below.

sudo npm install -g [email protected] --unsafe-perm=true --allow-root

Let me know if you face any issues for installing specific version of appium.

Upvotes: 3

Vishwathma
Vishwathma

Reputation: 91

This seems to be the issue with the permissions for the desired folders. Whereas the above solutions works absolutely fine. None of them specified to use the latest build. I would suggest to always use the latest appium(or whatever) version. So, the ideal command is: sudo npm install -g appium@latest --unsafe-perm=true --allow-root

Upvotes: 0

kidulf
kidulf

Reputation: 439

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

This command solved my issue as well

Upvotes: 0

Related Questions