如何使用React Native解决权限被拒绝的错误? [英] How to solve permission denied error with react native?

查看:537
本文介绍了如何使用React Native解决权限被拒绝的错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:

在终端中,我看到此文件具有"-rw-r--r--".我需要运行什么命令才能将其更改为正确的权限?

In terminal I see this file has "-rw-r--r--". What command do I need to run in order to change this to the right permission?

我正在尝试

react-native run-ios

并且我不断收到如下所示的错误:

and I keep getting the error shown below:

return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/Users/sharatakasapu/Desktop/projects/albums/node_modules/.cache/@babel/register/.babel.7.2.2.development.json'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at save (/Users/sharatakasapu/Desktop/projects/albums/node_modules/@babel/register/lib/cache.js:52:15)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

我尝试遵循为什么babel商店USERPROFILE路径中的.babel.json ,但是由于我是新手,所以不知道如何使用它来解决我遇到的问题.有关如何解决此问题的任何建议?

I tried to follow along at why babel stores .babel.json in USERPROFILE path but didn't understand how to use this to solve the problem I have as I'm new to react. Any advice on how to address this?

推荐答案

关于此问题,我很早以前就已经看到过这个问题!

About this i have seen this issue quite some time ago!

在某些情况下,它们听起来可能有些la脚,但请忍受我的阅读!

there can be too cases they might sound pretty lame though but bear with me and read!

1::您使用的用户个人资料无法访问目标文件!否则您可能无权访问根节点程序包!

1: the user profile you are using has no access to the files that are being targeted! or you might not have access to root node Packages! what you can do is

sudo chmod -R 777 /Users/sharatakasapu/{your node module path}

但是解决方案似乎有些琐碎!

but the solution one seems a little trivial!

2 :允许您当前的用户读取所有缓存和属性文件+文件夹!通过

2: allowing your present user to read all cache and property files + folders! by doing

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

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

有关更多信息,您可以点击以下链接.

for more you can follow these links .

对于解决方案1: stackLink

对于解决方案2: githubLink

这篇关于如何使用React Native解决权限被拒绝的错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆