I need help trying to install nestJS on my MacBook - installation

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

Related

Big Sur react native how to get watchman to run?

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

Homebrew install - sudo?

I am trying to install Homebrew in my terminal. It first asked me for Password which I typed in (the password I use to login to my computer) and hit enter. Then it comes up with 'Need sudo access on macOS!' - what does this mean? I am already the admin (as far as I know) as this is my personal laptop, noone else uses it.
I don't understand what else they need!
My aim is to install git but I can't even get this to install first..
Can anyone help, thanks :)
Open a new terminal session.
type sudo whoami
If it comes back with root then you have root privileges. You can also check under users and groups to see if you are an admin.
Also try running it again but using sudo first. You can also type sudo !! and that will run the previous command as sudo.
Run sudo visudo
Enter you password one last time
In the editor, search for %admin
The line probably looks like this:
%admin ALL = (ALL) ALL
Change it to this:
%admin ALL = (ALL) NOPASSWD: ALL
Save and Bob's your uncle.
If your macos account is in fact an Admin account, its password should be accepted by sudo.
See also this AskDifferent answer.
Simple solution
in the terminal type first
sudo su
Type the password
Install homebrew
So it's October 2022 and I came across the sudo messages AND I'm only running Catalina:
Go to this link: https://developer.apple.com/support/xcode/ to work out which version of Xcode is compatible with your macOS.
Sign in to your Apple Developer account and go to this page: https://developer.apple.com/download/all/. Keeping looking down the page till you come across your Xcode version but don't download Xcode just download "Command Line Tools for Xcode" with the same version number as as the compatible Xcode. These tools are a much smaller size than the Xcode file and this is really what Homebrew is looking for.
Run the downloaded installer for "Command Line Tools for Xcode".
Now run the script available on the Homebrew website: https://brew.sh, the current script is:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
This ran for me without any errors at all.
Cheers
To use a command as an admin, you need to use sudo before any command, even if you're already admin.

The reason for sudo when installing on mac via command line

Why do my macs require me to type sudo before command line installs?
For example, the Yeoman website says to run the command npm install -g yo but it fails unless I type sudo as a prefix sudo npm install -g yo.
The same thing happens while installing compass or nodejs.
It's not like typing sudo is a big deal, but it appears not everyone is required to follow this step.
Is there something I can do to avoid this?
Well the reason is simple: sudo means that you need root(admin) privileges. Thats to avoid that anybody can install softwares on your system. And I am not just talking about people, but more about softwares. It avoids that an other programm can install maleware/virus etc without your permission. It is actually a pretty good thing ;)

Is it possible to use firefox's google search bar directly from command line?

I checked through firefox's supposedly supported command line arguments and found this distinctly lacking, but I can't help but assume it must be somehow possible. Any thoughts on how? Currently running Ubuntu 11.10 if that changes anything.
If you're talking about the Developer Toolbar, it doesn't look like that has access to the built-in search. It's mainly for quick access to developer tasks (type help to see the full range of what it accesses), not for driving regular browsing tasks.
install googler using terminal in ubuntu
Step-1 : Install git(if not installed)
sudo apt-get install git
Step-2: Change the directory
cd /tmp
Step-3: Clone it from link given below using command
git clone https://github.com/jarun/googler.git
Step-4: get into googler directory
cd googler
Step-5:
sudo make install
Step-6:After that move to bash directory
cd auto-completion/bash/
Step-7:Finally copy file into etc/bash_completion.d
sudo cp googler-completion.bash /etc/bash_completion.d/
Now from terminal open googler
googler your_query
For further query refer here
use man googler for more option

Installing in Homebrew errors

Attempting to install rvm and ruby 1.9.2
I already installed homebrew and git, but couldn't get complete updates because I kept getting permission errors. Re-installed Snow Leopard and repaired permissions.
Now this happens...
$ brew install wget
Error: Cannot write to /usr/local/Cellar
sudo chown -R $USER /usr/local
You'll have to give yourself ownership of /usr/local/ using that line right there. I had to do this myself after using the ruby one-liner at the top of the official docs to install Homebrew. Worked like a charm for me. It ought to be the only time you'll ever need to sudo with Homebrew.
I'm not sure if the ruby one-liner does this. If it did, then something else on my system took control of /usr/local since.
Edit: I completely missed this, but #samvermette didn't (see replies to my answer): if you run this command above and have something installed via homebrew that requires special user permissions, like mysql, make sure to give those permissions back (as the above command gives recursive ownership to everything inside /usr/local to you ($USER). In the case of mysql, it's…
sudo chown -RL mysql:mysql /usr/local/mysql/data
I had this issue after upgrading to Mavericks, and this page was the top search result when googling the error message. I continued searching and found this answer on stack overflow.com. Put concisely, it is:
sudo chmod a+w /usr/local/Cellar
This fixed the issue for me, and as it only changes permissions for the specific path referenced in the error message, seemed unlikely to have negative side effects with other installations.
I'm putting this answer here for anyone else who may find this page first like I did. However, credit should go to jdi.
You can allow only Admin users writing into /usr/local/?
chgrp -R admin /usr/local
chmod -R g+w /usr/local
chgrp -R admin /Library/Caches/Homebrew
chmod -R g+w /Library/Caches/Homebrew
Since that each user who belongs to Admin group, will be able to install new dependencies.
On High Sierra you need the following command cause chown will not work:
sudo chown -R $(whoami) $(brew --prefix)/*
Link:
https://github.com/Homebrew/brew/issues/3228
uninstall and re install HomeBrew that will do the trick
I suggest ensuring that the current user is a member of the group that owns /usr/local. I believe by default, that group is wheel. To make yourself a member of that group:
$ sudo dscl . append /Groups/wheel GroupMembership $USER
Although something of an inelegant hammer, it has the intended effect - enabling access to items in /usr/local that are intended only for use (read/write) by elevated members. This approach has benefits of the other above because it takes advantage of the group memberships, enabling multiple (authorized) users on the system to use homebrew.
How did you install Homebrew? Their official installation instructions include running a ruby script. That should take care of the permission issues for you.
If you don't want to run a script, there is a section of that page called "Installing to /usr/local for Developers" that explains the change in permissions needed for the /usr/local directory.
EDIT: As mentioned in the comments it's a bad idea to use sudo with homebrew, so don't use the following answer!
You can also prevent this error if you execute the command with sudo:
$ sudo brew install wget
But take care of using sudo because you can make a lot of mistakes.

Resources