问题
UPDATE:
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?
I'm trying to run
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
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?
回答1:
About this i have seen this issue quite some time ago!
there can be too cases they might sound pretty lame though but bear with me and read!
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: 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 .
for solution 1: stackLink
for solution 2: githubLink
回答2:
You can try having a look at these two examples:
- https://github.com/bower/bower/issues/2262
- Error: EACCES: permission denied
Also try running your terminal as an Administrator if possible.
回答3:
If you give permissions, your error must no longer be visible. Generally on a MAC, the command is:
sudo chown YourName:staff /Users/YourName/.babel.json
回答4:
It looks like you have no permission- try this
sudo chmod -R 777 {path}
回答5:
Had the same problem.
This worked for me:
run
whoami
to get the current user.run:
sudo chown -R ownerName: /path/to/node_modules
回答6:
Give permission to the .babel file
来源:https://stackoverflow.com/questions/53877975/how-to-solve-permission-denied-error-with-react-native