Permissions Issue when installing expo-cli

Hi,

I followed the steps on expo to first download node v12.2.0. Right after that I tried installing the expo client by entering ‘sudo npm install expo-cli --global’ into my terminal. Unfortunately, I’ve been getting permissions issues and the installation is unsuccessful every time.

gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/expo-cli/node_modules/iltorb/.node-gyp’
gyp ERR! System Darwin 18.5.0
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /usr/local/lib/node_modules/expo-cli/node_modules/iltorb
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

ERR! sharp EACCES: permission denied, mkdir ‘/Users/amol/.npm/_libvips’
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see sharp - High performance Node.js image processing for required dependencies
gyp WARN EACCES user “root” does not have permission to access the dev dir “/Users/amol/.node-gyp/12.2.0”
gyp WARN EACCES attempting to reinstall using temporary dev dir “/usr/local/lib/node_modules/expo-cli/node_modules/sharp/.node-gyp”
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/expo-cli/node_modules/sharp/.node-gyp’
gyp ERR! System Darwin 18.5.0
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “rebuild”
gyp ERR! cwd /usr/local/lib/node_modules/expo-cli/node_modules/sharp
gyp ERR! node -v v12.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! sharp@0.22.1 install: (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.22.1 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! /Users/amol/.npm/_logs/2019-05-20T14_44_49_351Z-debug.log

Dunno what might be wrong. But here are two suggestions from SO:

  1. Make sure you’re using the correct npm (as sudoer). That is, maybe your npm isn’t installed in /usr/local/bin; maybe it’s in /usr/bin as like this post: node.js - Getting permission error while trying to install @angular/cli - Stack Overflow
  2. Try using --unsafe-perm. I forget what issue I was having myself recently, but that did the trick when installing globally as root; sometimes the UID gets set to the nobody user and fails. See, for example, this post: node.js - gyp ERR! stack Error: EACCES: permission denied, mkdir '/var/www/project_name/node_modules/node-sass/build' - Stack Overflow

Hi Jimbeau,
Thanks for the swift reply. I have applied given solution but still facing same issue. Can you please help me…

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.