How Can I Solve Permission Denied in React Native Project? - macos

anyone faced this issue after a run
react-native run-android/ios
android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java
(Permission denied)
when i write sudo before any command like npm install/yarn add etc it's work very well
otherways i got errors related to Permission

You might check the permissions on android/gradlew
They should be 755 not 644
Run chmod 755 android/gradlew inside your app root folder
then run react-native run-android
And it should work again
Finally remove the node modules and re-install using rm -rf node_modules && npm install

It looks like you have no permission- try this
sudo chmod -R 777 {path}

deleting node_modules folder from project and then running command npm i worked for me in existing react-native project

Related

react-native init AwesomeProject gives an error EPERM: operation not permitted, chmod '/node_modules/#react-native-com...'

After installing brew, watchman and node. I tried to initiate my first react-native application from the terminal on a Mac machine.
When I run the command like it says on React Native Development site - React Native CLI Quickstart for macOS and iOS target.
npx react-native init AwesomeProject
I get the following error
EPERM: operation not permitted, chmod '/usr/local/lib/node_modules/react-native/node_modules/#react-native-community/cli/build/commands/server/external/xsel'
I am logged in as an admin, so that is not an issue, and I have even tried "sudo", but with no success.
Has anybody faced a similar issue?
Thanks in advance.
It seems that you are having a permission problem try to change the permissions to react-native's folder with your username.
sudo chown userName -R [PATH]
to know your username run this command in the terminal
whoami
or just do the following
close all VS Code instances.
clean cache with
npm cache clean --force
install the latest version of npm globally as admin:
npm install -g npm#latest --force
clean cache with
npm cache clean --force
Try to install your component once again.
you may want temporarily disable your antivirus program and try again.

How to fix Error: laravel.log could not be opened Permission denied?

I'm pretty new at laravel,Actually when i create this command php artisan migration so i face this error how can i resolve this issue thanks.
Error
UnexpectedValueException : The stream or file
"/home/zubair/htdocs/project/storage/logs/laravel.log" could not be opened: failed to open
stream: Permission denied
If you run the command with sudo or chmod -R 755 some of the project's folders, you'll have it working.
sudo chmod -R 755 storage bootstrap/cache
Changing entire project folder's permission is probably not a good idea as your project becomes accessible to any user/script which kind of defeats the purpose of securing it behind root.
change a permission of storage folder
sudo chmod -R 775 /var/www/html/your-project/storage
for more info check this link install laravel in apache

Running yarn add requires sudo

For some reason when I try to add packages to a project with yarn add redux-thunk it fails with
error An unexpected error occurred:
"EACCES: permission denied, unlink '/Users/TuzMacbookPro2017/Development/code/ReactJS/recipe-helper-react-js/node_modules/.bin/acorn'".
or some other EACCES error. Adding sudo works, but I shouldn't have to do that in this case, right?
I followed these steps (replacing npm with yarn and now yarn add global works without sudo.
How do I fix the permissions for the normal yarn add command?
Most likely, at some point a package was added using sudo (in this case 'acorn').
Removing everything from node_modules and then reinstalling should fix it:
sudo rm -rf /Users/TuzMacbookPro2017/Development/code/ReactJS/recipe-helper-react-js/node_modules/
yarn install

Symfony cannot install new bundles because of composer permission issue

While try to install new bundles into my project composer issue happens which is regarding permission, issue follows
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile handling the symfony-scripts event terminated with an exception
Installation failed, reverting ./composer.json to its original content.
[Symfony\Component\Filesystem\Exception\IOException]
Failed to copy "/var/www/html/myProject/vendor/sensio/distribution-bundle/Composer/../Resources/skeleton/app/check.php" to "bin/symfony_requirements" because target file could not be opened for writing.
Thank you...
this might help you:
sudo chmod -R 777 bin/symfony_requirements
check if other directory and files need permission, for example in my case:
sudo chown -R $USER web/
was also needed.
furthermore if you had problem with cache and logs you may find following useful:
rm -rf var/logs
rm -rf var/cache
rm -rf vendor
and then using composer install
You have wrong permissions on file bin/symfony_requirements. Fix it and all will work like a charm

Cordova command not found - can not be used globally

so I have installed cordova using the following command to use it globally
sudo npm install -g cordova
and I get the following message
/Users/safwany/.node/bin/cordova -> /Users/safwany/.node/lib/node_modules/cordova/bin/cordova
cordova#5.1.1 /Users/safwany/.node/lib/node_modules/cordova
I keep typing cordova in the terminal but I am getting command not found. The only I can get it working is by typing the following:
/Users/safwany/.node/lib/node_modules/cordova/bin/cordova
Any idea how can I change that so I can use it globally by just typing cordova ?!
This seems to be a problem with the CHMOD rights of your folders. Try to own the folders like this:
sudo chown -R $USER /usr/local
sudo chmod -R 0775 /usr/local
after that, clear the npm cache with
sudo npm cache clear
finished? Go on by installing cordova again ->
sudo npm install -g cordova
type cordova into your terminal and everything should work like a charme.
Source: https://stackoverflow.com/a/19113963/3671726

Resources