安装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 existat 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 existat 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 errorinfo sharp Please see https://sharp.pixelplumbing.com/page/install for required dependenciesgyp 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 installgyp WARN install got an error, rolling back installgyp 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_64gyp 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/sharpgyp ERR! node -v v11.15.0gyp ERR! node-gyp -v v3.8.0gyp ERR! not ok npm ERR! code ELIFECYCLEnpm ERR! errno 1npm ERR! [email
protected] install: `(node install/libvips &
&
node install/dll-copy &
&
prebuild-install) || (node-gyp rebuild &
&
node install/dll-copy)`npm ERR! Exit status 1npm 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
【EACCES(在CentOS/RHEL 7上的权限被拒绝-已修复)】它像魅力一样运作。希望对你有帮助。
推荐阅读
- 用于生产JAVA应用程序系统的10个重要JVM选项
- 如何在Ubuntu 18上安装Puppet 6()
- 如何在Ubuntu 18上安装Chef()
- 如何在VirtualBox上安装Linux Mint()
- 如何在CentOS 7和8上安装dig()
- 如何在Windows上安装Ansible()
- 如何使用Hyper-V在Windows 10上安装Ubuntu()
- 解决java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"
- app 立即杀进程导致 webview保存的cookie失效