Cannot use brew install watchman - react-native

I am getting this error when trying to install watchman.
Warning: No available formula with the name "watchman".
==> Searching for similarly named formulae and casks...
Error: No formulae or casks found for watchman.
I'm following the react-native docs and one of the first steps is to brew install watchman. But I am getting an error.

fixed by removing remote.origin.url.
git config --global --unset remote.origin.url

Related

zsh: command not found: heroku, after installing through npm

I am trying to install the heroku-cli
I am on mac and I am using npm to install it.
npm install -g heroku
After installing I run the command heroku and the response I receive is:
zsh: command not found: heroku
I have been searching the internet for an answer for way too long now and can not seem to resolve this issue..
I have also downloaded the macOs tarbells and when I open the file, navigate to the bin folder and open the file "heroku" it opens my terminal and display this message.
Even after what looks like it has successfully been installed, when I type heroku --version I still get the command not found.
I am not the most experienced in this field. The reason I am trying to download heroku is because I am doing Fullstack Open.
I just hope it is an easy fix and someone more experienced than me can guide me in the right direction.
I should add I have tried uninstalling and reinstalling multiple times.
SOLUTION FOUND: The solution that helped me was installing homebrew and after installing I ran the command:
brew tap heroku/brew && brew install heroku
heroku command not
npm i -g heroku
zsh: command not found npm:
export NVM_DIR=~/.nvm
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh
zsh: command not
PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
export PATH

Yarn Type Error: "Invalid Number of Spaces"

I have a work project that is configured using yarn. I've used npm commands on other projects for the company, but for this project, I need to use yarn. The reason that I haven't used yarn before is because whenever I run any yarn commands locally, I get the following error:
TypeError: Invalid number of spaces
at tokenise (/usr/local/lib/node_modules/yarn/lib/cli.js:63358:17)
at tokenise.next (<anonymous>)
I'm on a mac and have tried running yarn, brew install yarn,npm install --global yarn and curl --compressed -o- -L https://yarnpkg.com/install.sh | bash. I've also tried npm uninstall yarnand brew uninstall yarn to try to start fresh, but after each attempt at removing and reinstalling, I get the same error.
The cloned repository that I'm working with includes a .yarnrc file and a yarn.lock file. Also, I'm on a work vpn, and have to install dependencies over the vpn, so I have a mirror registry in my .yarnrc file.
Any suggestions on where to start troubleshooting? Obviously, I'm doing something wrong here.

How to fix 'command not found' for aws-cdk after running the npm install

I am trying to install the aws-cdk and in the terminal and I run the npm install -g aws-cdk. As stated here After npm runs, I get:
/usr/local/Cellar/node/9.8.0/bin/cdk -> /usr/local/Cellar/node/9.8.0/lib/node_modules/aws-cdk/bin/cdk
+ aws-cdk#0.31.0
updated 1 package in 1.636s
If I try to run cdk I get:
zsh: command not found: cdk
Installing as root worked for me:
sudo npm install -g aws-cdk
Make sure /usr/local/Cellar/node/9.8.0/bin is in your PATH
In my case, I added this to the end of my .bash_profile:
export PATH=$PATH:$(npm get prefix)/bin.
I did that based on information from a different thread.
If you're using nvm to manage your node versions, make sure that the CDK package is being installed in the same version of node you're currently using or the version you want to use.
The OP noted their CDK was getting installed in node/9.8.0:
Check the current node version running: nvm current.
If you see that the CDK installation location is different than the node version indicated by nvm current, you'll need to switch your node version using:
nvm use <node-version-where-cdk-is-installed>
In the OP's case, this would be nvm use 9.8.0.
What worked for me in mac was adding to the path the bin directory of globally installed node modules.
Install aws-cdk by:
npm install -g aws-cdk
Try to run it
cdk
no command found error
make or edit your .zshrc file in your user directory
add line to .zshrc with export PATH=$PATH:/{your_user_path}/.npm-global/bin
execute it source .zshrc
now cdk should work
Pay attention that it is mac based approach.

Installing specific node version using NVM gives an error

I want to install node v6.10.3. but when I tried to install it gives the following error. What causes this error?
creating .\config.gypi
creating .\config.mk
bash: make: command not found
nvm: install v6.10.3 failed!
(nvm maintainer here) Could you file this on http://nvm.sh, and fill out the issue template? This kind of question is more appropriate for the repo than for SO.

yarn self-update throws OAuth2 Authentication error

I am trying out the yarn self-update command to see how it works, but instead of updating the Yarn version, it throws an OAuth error like so
yarn self-update
yarn self-update v0.15.1
error OAuth2 authentication requires a token or key & secret to be set
at __dirname.authenticate (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/node_modules/github/lib/index.js:334:23)
at Object.<anonymous> (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/lib/cli/commands/self-update.js:30:12)
at next (native)
at step (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:35:14
at new Promise (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/node_modules/core-js/library/modules/es6.promise.js:191:7)
at Object.<anonymous> (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/node_modules/babel-runtime/helpers/asyncToGenerator.js:14:12)
at Object.run (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/lib/cli/commands/self-update.js:99:17)
at run (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/lib/cli/index.js:237:18)
at config.init.then (/Users/nikjohn/.nvm/versions/node/v6.4.0/lib/node_modules/yarn/lib/cli/index.js:345:12)
info Visit http://yarnpkg.com/en/docs/cli/self-update for documentation about this command.
Does anybody know why this is and what needs to be done to resolve this? According to the docs here, this command does not have any such OAuth dependency and IMHO it shouldn't either.
Looks like there's a PR for this already here
Edit: Further research shows this is a known bug with Yarn. But a resolution is still not available. It would be a weird catch22 if the fix is pushed out as a new version, but users can't update because the command fails. One possible solution is yarn self-update [tag] instead of yarn self-update, but this remains a bug.*
Edit: I realized there's another workaround
yarn version
yarn version <version-number>
Use npm -g install yarn to update it. I got upgreaded to yarn v0.16.0 and now yarn self-update seems to work.
First remove Yarn with this command:
rm -rf ~/.yarn
And then install it again, using this command (for example):
curl -o- -L https://yarnpkg.com/install.sh | bash
TL;DR
Update to ≥0.16.0:
Ubuntu
apt-get update ; apt-get install yarn
MacOS
brew update ; brew upgrade
NPM
npm install -g yarn --update
Explanation
Had the issue on 0.15.0, and looking into it lots of people add the same issue.
$ yarn --version
0.15.0
Reading the release notes for v0.16.0
Fix self-update (#676)
So simply update :
yarn self-update
yarn self-update v0.16.0
success Yarn is already using the latest version.
Done in 0.69s.
npm uninstall -g yarm
npm cache clean
npm install -g yarm