sharp EACCES: permission denied on CentOS/RHEL 7 – FIXED

sharp EACCES: permission denied on CentOS/RHEL 7 – FIXED

A solution to sharp EACCES permission denied error while installing the nodejs package.

While installing the Nodejs package Browsertime, I got the following error.

[[email protected] ~]# npm install browsertime -g /usr/bin/browsertime -> /usr/lib/node_modules/browsertime/bin/browsertime.js > @sitespeed.io/[email protected] install /usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/chromedriver > node install.js (node:26690) UnhandledPromiseRejectionWarning: Error: Destination Folder must exist at DownloaderHelper.__validate (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/chromedriver/node_modules/node-downloader-helper/dist/index.js:390:23) at new DownloaderHelper (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/chromedriver/node_modules/node-downloader-helper/dist/index.js:61:20) at download (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/chromedriver/install.js:68:18) (node:26690) 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:26690) [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. > @sitespeed.io/[email protected] install /usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/geckodriver > node install.js (node:26701) UnhandledPromiseRejectionWarning: Error: Destination Folder must exist at DownloaderHelper.__validate (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/geckodriver/node_modules/node-downloader-helper/dist/index.js:387:23) at new DownloaderHelper (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/geckodriver/node_modules/node-downloader-helper/dist/index.js:61:20) at download (/usr/lib/node_modules/browsertime/node_modules/@sitespeed.io/geckodriver/install.js:73:18) (node:26701) 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:26701) [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. > [email protected] install /usr/lib/node_modules/browsertime/node_modules/sharp > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy) ERR! sharp EACCES: permission denied, mkdir '/root/.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 https://sharp.pixelplumbing.com/page/install for required dependencies gyp WARN EACCES user "root" does not have permission to access the dev dir "https://geekflare.com/root/.node-gyp/11.15.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "https://geekflare.com/usr/lib/node_modules/browsertime/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/lib/node_modules/browsertime/node_modules/sharp/.node-gyp' gyp ERR! System Linux 3.10.0-957.27.2.el7.x86_64 gyp ERR! command "https://geekflare.com/usr/bin/node" "https://geekflare.com/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/lib/node_modules/browsertime/node_modules/sharp gyp ERR! node -v v11.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] 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 [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:

I tried a few things, but nothing worked. After a little bit of search, I found npmjs documentation and tried  --unsafe-perm flag.

npm install --unsafe-perm

Ex: for my installation.

npm install --unsafe-perm browsertime -g

It worked like a charm. I hope it helps you too.

NEWEST POSTS

Our trusted sources

We only publish news from well-known cybercrime magazines via RSS. You will find here everything about hackers & cybercrime. Also you can visit the direct sources from us.

Just click on one of the buttons.

PROTECT YOURSELF

Check out our Guidebook page.  And read everything about it.  Also how to protect yourself from hacker attacks.  An all in one thing.