个性化阅读
专注于IT技术分析

EACCES:在CentOS/RHEL 7上的权限被拒绝-已修复

安装nodejs软件包时, 针对sharp EACCES权限拒绝错误的解决方案。

安装Nodejs包Browsertime时, 出现以下错误。

[[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 "/root/.node-gyp/11.15.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/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 "/usr/bin/node" "/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:

我尝试了几件事, 但没有任何效果。经过一番搜索, 我找到了npmjs文档并尝试了–unsafe-perm标志。

npm install --unsafe-perm

例如:用于我的安装。

npm install --unsafe-perm browsertime -g

它像魅力一样运作。希望对你有帮助。

赞(0)
未经允许不得转载:srcmini » EACCES:在CentOS/RHEL 7上的权限被拒绝-已修复

评论 抢沙发

评论前必须登录!