尝试在 Ubuntu 中安装 opencv4nodejs 时权限被拒绝 [英] Permission denied while trying to install opencv4nodejs in Ubuntu
本文介绍了尝试在 Ubuntu 中安装 opencv4nodejs 时权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用以下命令在 Ubuntu-20.04
中安装 opencv4nodejs
,我的节点版本是 v12.19.0
I was trying to install opencv4nodejs
in Ubuntu-20.04
using the following command and my node version is v12.19.0
sudo npm i -g opencv4nodejs
但是遇到这些错误
info install installing opencv version 3.4.6 into directory: /usr/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv
ERR! Error: Command failed: mkdir -p opencv
mkdir: cannot create directory ‘opencv’: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build@0.1.9 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build@0.1.9 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! /root/.npm/_logs/2020-10-28T06_33_21_090Z-debug.log
推荐答案
使用 sudo 运行 NPM 安装可能会导致权限问题.您可以尝试完全删除 node_modules 目录并重新运行 NPM 安装它而无需 sudo.
Running NPM install with sudo might be causing a permissions problem. You could try completely removing the node_modules directory and re-running NPM install it without sudo.
还要确保您有权写入要安装的目录吗?
Also make sure you have permission to write to the directory you're installing in?
如果还是不行,请按以下步骤操作:
If it still doesn't work please follow this:
sudo npm install -g opencv4nodejs --unsafe-perm=true --allow-root
这篇关于尝试在 Ubuntu 中安装 opencv4nodejs 时权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文