bash 错误:EACCES,权限被拒绝 Ionic Cordova IOS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25598377/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:39:23  来源:igfitidea点击:

Error: EACCES, permission denied Ionic Cordova IOS

bash

提问by anuraagy

I keep getting the following errors:

我不断收到以下错误:

Error: EACCES, permission denied '/Users/Anuraag/.cordova/lib/tmp' . 

Whenever I try to do cordova add platform ios for my cordova app. What is the issue please help!!

每当我尝试使用cordova为我的cordova应用程序添加平台ios时。有什么问题请帮忙!!

回答by Jeremy Harris

The error you have received is from NPM (since the Cordova CLI is installed via NPM). This is a tricky issue where using NPM with sudo, and then notusing sudowill result in weird permission issues.

您收到的错误来自 NPM(因为 Cordova CLI 是通过 NPM 安装的)。这是一个棘手的问题,将 NPM 与sudo,一起使用,然后使用sudo会导致奇怪的权限问题。

If you followed the instructions on the Cordova documentation, it has you install Cordovausing sudo. It then has you do this:

如果按照科尔多瓦文档上的说明,它具有安装科尔多瓦使用sudo。然后它让你这样做:

# To ensure permissions are correct, run this command on Mac or Linux, changing LOGIN to match your account name:
$ sudo chown -R LOGIN /usr/local/lib/node_modules/cordova

Did you do that step? If not try it. If that doesn't work, make sure the '/Users/Anuraag/.cordova/lib/tmp'directory can be accessed. Given that it is a local temporary directory, there is most likelyno harm in giving it full read/write access with something like:

你做了那一步吗?如果没有试试。如果这不起作用,请确保'/Users/Anuraag/.cordova/lib/tmp'可以访问该目录。鉴于它是一个本地临时目录,使用以下内容为其提供完全读/写访问权限很可能没有害处:

chmod -R 777 '/Users/Anuraag/.cordova/lib/tmp'

回答by jasmo2

For me worked:

对我来说工作:

sudo chown -R LOGIN ~/.config/configstore/update-notifier-cordova.json

sudo chown -R LOGIN ~/.config/configstore/update-notifier-cordova.json

Also I am using nvmwhich separates spaces and makes easier to maintain an app.

此外,我正在使用nvm分隔空间并使维护应用程序更容易。

回答by Mohd. Umar

None of the solution worked for me

没有一个解决方案对我有用

Finally,this work perfectly

最后,这个工作完美

sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config

回答by Bruno

sudo chown -R $USER /usr/local/lib/node_modules

sudo chown -R $USER /usr/local/lib/node_modules

回答by MJ Montes

sudo chown -R USERNAME .

to check whats your USERNAME, type in whoamiin command line

要检查您的 USERNAME,请whoami在命令行中输入

回答by rawathemant

npm uninstall -g ionic
npm install -g ionic

回答by Edo Udoma

On Mac Terminal
This worked for me.

在 Mac 终端上
这对我有用。

sudo chown -R $(whoami) ~/.npm

回答by Ana Helena

This was what worked for me:

sudo chown -R $USER:$(id -gn $USER) /Users/YOURUSERNAME/.config

这对我有用:

sudo chown -R $USER:$(id -gn $USER) /Users/YOURUSERNAME/.config

回答by Hymansonkr

After trying every single solution here I had to BEGRUDGINGLY reinstall ionic

在尝试了这里的每一个解决方案后,我不得不重新安装 ionic

npm i -g ionic

npm i -g ionic

Begrudgingly because my plan was to upgrade ionic to see what would break but first I wanted to run it at the current version first to see if everything still worked.

不情愿地,因为我的计划是升级 ionic 以查看会中断什么,但首先我想先在当前版本上运行它,看看一切是否仍然有效。

回答by kdpnz

Similar to jasmo2, this worked for me:

与 jasmo2 类似,这对我有用:

sudo chown -R LOGIN ~/.config/configstore