I am trying to run a react native project but I keep getting:
Watchman: watchman --no-pretty get-sockname returned with exit code=1, signal=null, stderr= 2020-12-20T01:04:27,184: [0x118044e00] the owner of /usr/local/var/run/watchman/mattroberts-state is uid 0 and doesn't match your euid 501
I think it is a permission problem but I don't know how to fix it. Does anyone know what is wrong and how to fix it?
If I could get the uid to match the euid, it seems it should be fixed, but I don't know how.
If I could get the uid to match the euid, it seems it should be fixed, but I don't know how.
Looks like the owner of the watchman state directory is set to root. You can fix it by running:
sudo chown -R "$(whoami)" "/usr/local/var/run/watchman/$(whoami)-state"
While I was unable to fix Watchman, after uninstalling it the React Native app runs. I don't think it will automatically reload, but you can still cause a reload to occur with command r in the simulator.
Since I had installed Watchman with homebrew,
I uninstalled it with
brew uninstall Watchman
in the terminal
this worked for me
sudo chmod 0700 /usr/local/var/run/watchman/$(whoami)-state
Related
I am having issues trying to install nestJS for my MacBook and this error keeps popping up in my terminal when I use $ npm install -g #nestjs/cli . Am I doing something wrong or am I not putting this command line in the right place? Please help :)
Running the command as sudo is only a temporary solution as you generally want to have access to this directory as a regular user and you will undoubtedly run into future issues working with node_modules.
The right approach is to change the ownership on this directory so you don't need to use elevated permissions to interact with it.
sudo chown -R $USER /usr/local/lib/node_modules
I'm new to CocoaPods, I tried running 'pod install' on my Mac to install my pod, but I'm getting a permissions error with the folder /Users/username/Library/Caches/CocoaPods. That folder doesn't even exist! Did I accidentally delete it at one point? How do I restore it?
There is however a folder called /Library/Caches but its not under my username, its at the root.
I'm a little confused. If someone can just direct me in the right direction, I would really appreciate it.
Here is the full error message:
Errno::EACCES - Permission denied # dir_s_mkdir - /Users/nachshonfertel/Library/Caches/CocoaPods
You can solve this in 2 ways.
Add CocoaPods folder on ~/Library/Caches/CocoaPods then try
pod install
OR
Give full permission on you project
cd your-project
chmod -R 777 .
cd ios
pod install
Turns out it was a permissions error. And the folder I thought didn't exist, was hidden in finder > Go > (Hold Down Option Key) Library
Took me 2 full days to finally figure it out!
Are you using system Ruby or have you installed Ruby with sudo?
You basically have 2 options:
use sudo pod install
Probably the easiest/fastest way for you go forward
This typically causes more problems than Ruby being owned by non-root
When you install packages they will have sudo access!
Install Ruby, non-sudo; you can try
github.com/postmodern/ruby-install together with github.com/postmodern/chruby (my personal favourite), rvm.io is also very popular
The benefit of this approach is that you also can switch Ruby version whenever you like (and as mentioned above; more secure less insecure..)
I had been struggling with this issue for a while. For some reason, in my case the problem was that the folder ~/Library/Caches/CocoaPods was not there, and cocoapods wasn't able to create it when running 'pod install'. Hence the permission error.
After trying several things, I created that folder manually (which prompted for my password), ran 'pod update' and my problem was fixed!
Hope this saves someone some trouble.
I solved the problem creating the missing folder Users (in my case the error was Permission denied # dir_s_mkdir - /Users/Users) and give full permission to all users.
I managed to solve my issue in following steps:
Create CocoaPods folder (if it doesn't exist) cd ~/Library/Caches && mkdir CocoaPods
Give access to CocoaPods folder sudo chmod 777 Cocoapods
Create Pods folder cd CocoaPods && mkdir Pods
Give access to Pods folder sudo chmod 777 Pods
I hope it helps !
I have a problem here. I've installed cocoapods on my Mac because I need it for my XCode project. I've runned this command
gem install cocoapods
which works fine, all things were installed. But I after that when I tried to use any pod COMMAND thing, I've got the error - You cannot run CocoaPods as root.
I've looked through stackoverflow, and the main advices were to use this commands
sudo chown -R $USER ~/.cocoapods or sudo chown -R $USER ~/Library/Caches/CocoaPods
but the problem is none of those commands were working for me and I've got this error:
chown: /Users/user/.cocoapods: No such file or directory
Could you tell me where I'm wrong?
Ok, guys, I've figured out the problem. Just need to do what the error says. You shouldn't run pod install command with sudo or from the root user. It means - just open new terminal window and don't log to the root user and work with pod
I found an issue when running sudo pod install command after updating it to latest version 0.32.1. Earlier it was working very fine.
When I tried to do pod install with older cocoapods, it asked me to update to latest cocoapods version i.e. 0.32.1. After I updated by cocoapods gem, I can't do sudo pod install in my Xcode project. It gives me following error.
± sudo pod install ruby-1.9.3-p0
Password:
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/gems/1.9.1/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
CocoaPods, the Objective-C library package manager.
Commands:....
Any suggestion to overcome the issue would be very helpful. Thanks in advance.
I had to update permission on CocoaPods
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
Since it seems to fix the problem for some people, you might want to try running "pod install" and see if it fixed your problem from that point. However, I still had a permission denied when running "pod install" for a pod item, so running the next line will overwrite permission for the pod folder.
sudo chown -R $USER ./Pods
I have removed the old podfile.lock before running pod install
Source :
cocoaPods pod install Permission denied
https://github.com/CocoaPods/CocoaPods/issues/509
I am working with windows. After reading all tips which didn't work I drove into the code base.
As a disclaimer, I am beginning phase of developing an app and my goal is to get a quick proof of concept. Therefore, this solution will only bypass that the error message as a quick hack.
In the file ~/lib/cocoapods/command.rb you will find a function on line 47 that stops the program if there is a root user.
#help! 'You cannot run CocoaPods as root.' if Process.uid == 0
Simply comment out the line. Again, this is a terrible idea to do in any situation except as a pragmatist using Windows and trying to get proof of concept out.
Nothing worked for me except the following
switched to ios platform with cd platforms/ios
switched ownership of the folder to the current user with sudo chown -R YourUsername .
Pod install
In m1 MACs run sudo arch -x86_64 pod install --allow-root to resolve this issue.
in my case, the both "folder content project" and file "project.xcodeproj" was locked "i ignore why !!! maybe the git clone provoked error :s", i unlock the folder and apply all changes for sub folder .... And it WORK FINE :D
I've searched around a bit and can't seem to find any record of anyone else with this problem.
Whenever I try to run
$ brew update
I am rewarded with
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
This isn't my machine and I normally develop on Linux systems so this is all a bit odd to me.
Any help would be greatly appreciated! Please tell me if there is any additional info I should provide. Again, I'm not used to homebrew or OSX.
EDIT
at the request of JameA
xiao:~ patrick$ brew doctor
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
xiao:~ patrick$ brew --config
/usr/local/bin/brew:34: uninitialized constant MACOS (NameError)
...Not sure I like this whole "here, use this macbook for the project, it works better" thing...
I'm pretty sure the root cause of this is a failed upgrade attempt to Homebrew 0.9.5 from a much earlier version. Basically, if you run brew update as opposed to sudo brew update a portion of files are updated, while others are not. Here's what worked for me:
Edit /usr/local/bin/brew (it's just a Ruby file, not a compiled binary, so any text editor will do). You'll find a block like:
if MACOS and MACOS_VERSION < 10.5
abort <<-EOABORT.undent
Homebrew requires Leopard or higher. For Tiger support, see:
https://github.com/mistydemeo/tigerbrew
EOABORT
end
Comment this out. Even if you don't know Ruby, you can probably intuit what this is doing—it's checking to see if you have a current version of OSX. Assuming that you do in fact have this version, this sanity check isn't necessary. Brew is still broken, but at least now it will load far enough to give error messages.
Run sudo brew update, spoiler alert: it fails, but this time with a meaningful error message:
$ brew update
error: Your local changes to the following files would be overwritten by merge:
[giant list of files here]
Well, today I learned that brew update is just a wrapper for git pull because anyone who has worked with git knows that error message. We can fix this too.
Switch into the homebrew git repository with cd /usr/local and give the command git reset --hard FETCH_HEAD.
This piece found here.
Give the command sudo brew update. Homebrew should now update successfully and work properly!
Once the system is working again, you can actually kind of see why an error like this would have occurred. For one, usr/local/bin/brew has been completely rewriten and isn't even Ruby anymore, and most of its configuration has been moved into /usr/local/Library/brew.rb which no longer uses the constants MACOS or MACOS_VERSION constants, as they have been replaced by the more object oriented OS.mac and MacOS.version.
The MACOS constant is set in globals.rb. It seems like you may have a borked installation of Homebrew.
Check the output of brew doctor for any suggestions.
If that doesn't help please update with the results of brew --config.
If all else fails you may want to try re-installing Homebrew.
UPDATE:
Since this was a previous user's machine make sure your user is the owner of /usr/local and everything within. Fix it with sudo chown -R $USER /usr/local.
I had a similar issue, when I Killed an install mid-way with Ctrl-D.
Post that whenever I tried installing anything it gave the following error
uninitialized constant Homebrew::CLI::Parser::ARGV_WITHOUT_MONKEY_PATCHING
As a fix, I went to the directory I had where homebrew was installed, and reset the HEAD.
cd /usr/local/Homebrew
git status
git checkout .
And then it started working magically.
I had a similar error with a "borked" installation of brew. I removed the small 5 line block of code in the /usr/local/bin/brew script starting with the MACOS line. That did the trick to allow me to uninstall and eventually reinstall it.
In addition to Matt Korostoff's answer.
On point 3 (resetting the repo), for recent version of Homebrew, the repo is no longer /usr/local, do cd "$(brew --repo)" instead.