Unable to install packages via npm; can only use homebrew - shell

I a trying to install some cli tools to use globally. Running the install command via npm never works - I get command not found [package] whenever I check [package] -v. I have tried this with netlify-cli, firebase-tools, and heroku.
However, when I install heroku via homebrew (brew tap heroku/brew && brew install heroku) it seemed to work fine. The version info showed up on heroku -v.
If it's relevant, I'm using MacOS 13.0, and ohmyzsh on iTerm2. I tried the built-in terminal (which also runs zsh) but had no luck.
How can I reliably use npm in order to install tools?

Related

Can't deploy heroku on Mac OS M1

I'm new on Heroku and trying to deploy my project here. After I typed this command in the terminal: curl https://cli-assets.heroku.com/install.sh | sh
and I also typed the administrative password correctly , I got this error message: unsupported arch: arm64
The script does not support arm64 (see line 40 pf the script).
The easier option is to install via brew
brew tap heroku/brew && brew install heroku
or download the tarball for macOS (if you still prefer doing it manually)
Download the tarball macOS
tar xvf heroku-darwin-x64.tar
sudo mv heroku /usr/local/lib
cd /usr/local/bin
ln -s /usr/local/lib/heroku/bin/heroku .
heroku --help
Apple Silicon Issues
If you’re getting the following error on a machine with an Apple M1 chip, you haven’t installed or declined to install Rosetta 2.
Bad CPU type in executable
Installing Rosetta 2 resolves this issue.
If you don’t want to install Rosetta 2 on your machine, you can install the Heroku npm package globally and use your own Node binary locally. Only v16 of Node has M1 ARM support and npm isn’t the recommended install method.
ref: heroku install
brew tap heroku/brew && brew install heroku
This command doesn't work for me
==> Installing heroku from heroku/brew
Error: Your Xcode (14.0.1) is too outdated.
Please update to Xcode 14.1 (or delete it).
Xcode can be updated from the App Store.
but there is no update in theApp Store.
Try
arch -arm64 brew install heroic
Try
arch -arm64 brew install heroku

NativeScript cocoapods is not installed when using sudo

I am trying to setup a nativescript development environment on a mac.
I installed all the dependencies including cocoapods. When I run tns doctor it all checks out, but when I run sudo -E tns doctor - it says cocoapods is not installed or is not configured correctly.
I need this to work in sudo since using npm run build:ios says I have no permission.
Any Ideas?
Whenever this happens to me I uninstall everything (tns, npm, node), and reinstall again.

How to install apps with homebrew in OS X

i want to install virtual box on mac os EI Captain with homebrew and also if i want to install more packages with homebrew how can i know that package is available in homebrew?
Thanks
First, you’ll need the command-line tools for Xcode installed. On a modern Mac OS X system, you can install these just by running the following command in a Terminal window. You could also install the full Xcode application from Apple, if you prefer — but that takes up more space on your Mac and isn’t necessary.
xcode-select --install
Next, install Homebrew. You can just open a Terminal window, copy-paste the following command, and press Enter:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
This script informs you what it will do. Press Enter and then provide your password to install it. By default, it installs Homebrew so you can use the brew command without typing the sudo command and providing your password.
Run the following command once you’re done to ensure Homebrew is installed and working properly:
brew doctor
Once you’re done, run the following command to install Homebrew Cask. It uses Homebrew to install Cask:
brew install caskroom/cask/brew-cask
Now you can install the Virtual box by entering the following commands
brew install vagrant-completion
brew cask install virtualbox
brew cask install vagrant
brew cask install vagrant-manager
For knowing that your package is available or not you can search your desire package by the following commands
For Open-Source Utilities
brew search name-of-your-package
For graphical Apps
brew cask search name-of-your-app
For installing Graphical Apps run
brew cask install name-of-your-app
For installing Open-Source Utilities run
brew install name-of-your-package

Installing PhantomJS on Mac

I'm trying to install PhantomJS on my Mac (Yosemite).
I did the following:
npm install phantomjs
Then I did:
npm install phantomjs-prebuilt
Both of which appear in my node_modules. But when I try to run phantomjs --versionI get
-bash: phantomjs: command not found
Also tried installing the binary from the downloads website, but nothing. What am I missing? End goal is to use casperjs but currently casper is asking
Fatal: [Errno 2] No such file or directory; did you install phantomjs?
I thought I did....?
If you are using Homebrew, you can type:
brew tap homebrew/cask
brew cask install phantomjs
Download phantomjs latest version (ex: phantomjs-2.1.1-macosx.zip) from http://phantomjs.org/download.html
Extract it to some path(ex: ~/Desktop/phantomjs-2.1.1-macosx)
Run this command on terminal -
sudo ln -n ~/Desktop/phantomjs-2.1.1-macosx/bin/phantomjs /usr/local/bin/
Launch phantomjs from the terminal by command: phantomjs
Check phantomjs version by command: phantomjs -v
Check the phantomjs path by command: which phantomjs
The accepted answer is outdated. On Mac, using Homebrew, type:
brew tap homebrew/cask
brew cask install phantomjs
The first step may not be necessary for some MacOS versions.
For newer versions of cask (2021 and later), use
brew install --cask phantomjs
You need to add phantomjs binary to your PATH. You can do this either by modifying the environment variable or by symlinking the binary to for example /usr/local/bin
For example, if you want to symlink the binary:
cd $HOME
curl -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
ln -s $HOME/phantomjs-2.1.1-macosx/bin/phantomjs /usr/bin/phantomjs
or if you want to modify the PATH environment variable:
cd $HOME
curl -O https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
and add this line to this file: ~/.bash_profile:
export PATH=$HOME/phantomjs-2.1.1-macosx/bin:$PATH
and then run:
source ~/.bash_profile
Shouldn't you be installing phantomjs globally?
npm install -g phantomjs
Since you are installing it locally, the command -
phantomjs -v
would not work everywhere.
You can check the difference between local install and global install here: https://docs.npmjs.com/cli/install
After a lot of digging I found that on on High-Sierra old versions of phantomjs (<2.0) would not work.
Also, the zip file via the phantomjs download page is a faulty one.
If you need a new phantom, just go to this page and download phantomjs 2.1.1 (or later).
for Mac BigSur
brew tap homebrew/cask
brew install --cask phantomjs

Install docker-machine on OSX WITHOUT Docker Toolbox

Am I correct to assume that installing Docker Toolbox is now the required method for installing docker-machine on OSX? I have a script that I've been using for onboarding my team of developers, which installs docker related tools like docker-machine, but it pulls it in through curl. This stopped working with the latest version. All their documentation says I need to install Docker Toolbox, with no indication of an alternative. Is there still a way to install it through the command line?
I installed virtualbox, docker, docker-machine and docker-compose all via homebrew, and worked like a charm to me.
$ brew install docker docker-compose docker-machine
if you don't have installed virtualbox, you could install it using homebrew cask.
$ brew cask install virtualbox
One important thing you obtain when you installing it this way, is the bash completion. You need to install bash-completion, previously, for this benefit.
$ brew install bash-completion
Answered my own question. It's undocumented, but if you go to their github page, then click on releases, you'll see all the latest releases for the OS you're looking for. https://github.com/docker/machine/releases. Find the download you need, then run this:
$ curl -L https://github.com/docker/machine/releases/download/v0.4.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
$ chmod +x /usr/local/bin/docker-machine
You can install it also with Homebrew
$ brew install docker-machine

Resources