I looked at the numerous posts on here regarding this issue and tried them but had no success resolving this.
I am on MacOS and here is what I have done so far based on recommendations I have found here but I still get this error
~~ sudo npm uninstall -g angular-cli
~~ sudo npm uninstall -g #angular/cli
~~ sudo npm cache clean --force
~~ sudo npm install -g #angular/cli
This outputs:
/usr/local/Cellar/node/11.10.0/bin/ng -> /usr/local/Cellar/node/11.10.0/lib/node_modules/#angular/cli/bin/ng
> #angular/cli#8.3.6 postinstall /usr/local/Cellar/node/11.10.0/lib/node_modules/#angular/cli
> node ./bin/postinstall/script.js
+ #angular/cli#8.3.6
added 245 packages from 185 contributors in 8.784s
However, issuing command below does not work:
~~ ng version
-bash: ng: command not found
Some people suggesting linking so I tried that as well:
~~ sudo npm link #angular/cli
, which outputs following:
/Users/dinob/node_modules/#angular/cli -> /usr/local/Cellar/node/11.10.0/lib/node_modules/#angular/cli
, but ng version is still not working:
~~ ng version
-bash: ng: command not found
Many posts suggest that there should be a directory .npm-global created under my /Users/dinob directory but I dont see it. I aonly see .npm directory, not .npm-global.
I also tried following:
uninstall angular as described above
brew update
brew upgrade node // this upgraded from 11.10.0 to 12.10.0
then repeat steps above to install angular/cli
still same problem, ng command not found
This is not a duplicate question as KenWhite suggests and I have reviewed all the posts on SO I could find (and more) regarding this issue, tried them and none of them solved the issue for me.
sudo npm install -g #angular/cli command completed and returned following paths but none of them #angular directory in them:
/usr/local/Cellar/node/11.10.0/bin/ng -> /usr/local/Cellar/node/11.10.0/lib/node_modules/#angular/cli/bin/ng
Above, there is no bin folder:
dinob # /usr/local/Cellar/node/11.10.0
~~ ls -la
total 80
drwxr-xr-x 8 dinob staff 256 2 Oct 11:30 ./
drwxr-xr-x 5 dinob staff 160 27 Sep 09:29 ../
-rw-r--r--# 1 dinob staff 8196 2 Oct 11:32 .DS_Store
-rw-r--r-- 1 dinob staff 26696 14 Feb 2019 README.md
drwxr-xr-x 3 dinob staff 96 14 Feb 2019 etc/
drwxr-xr-x 3 dinob staff 96 14 Feb 2019 include/
drwxr-xr-x 5 dinob staff 160 2 Oct 11:22 lib/
drwxr-xr-x 5 dinob staff 160 14 Feb 2019 share/
Same for this location > #angular/cli#8.3.6 postinstall /usr/local/Cellar/node/11.10.0/lib/node_modules/#angular/cli:
dinob # /usr/local/Cellar/node/11.10.0/lib/node_modules
~~ ls -la
total 16
drwxr-xr-x 6 dinob staff 192 2 Oct 11:22 ./
drwxr-xr-x 5 dinob staff 160 2 Oct 11:22 ../
-rw-r--r--# 1 dinob staff 6148 2 Oct 11:27 .DS_Store
drwxr-xr-x 7 root staff 224 26 Sep 16:42 n/
drwxr-xr-x 26 dinob staff 832 2 Oct 11:28 npm/
drwxr-xr-x 6 dinob staff 192 15 Jul 16:32 react-native-cli/
After days of googling and getting no help neither on here nor from #Angular github which is pretty much useless, was finally able to resolve the issue and get my angular ng command not found issue resolved following these steps:
1. Instal nvm
Issue these 3 commands to install nvm. (Angular documented steps https://angular.io/guide/setup-local to setup your environment did not work for me).
So I installed nvm like so:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
export NVM_DIR="/Users/your-user-name/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
After this, make sure you restart terminal and you should be able to issue nvm --version to see version of installed nvm.
2. Install node using nvm
nvm install stable
nvm install node
3. Finally, install angular
npm install -g #angular/cli
4. Restart terminal
Restart terminal and you should be able to use ng version to see version installed on your system
~~ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.6
Node: 12.11.1
OS: darwin x64
Angular:
...
Package Version
------------------------------------------------------
#angular-devkit/architect 0.803.6
#angular-devkit/core 8.3.6
#angular-devkit/schematics 8.3.6
#schematics/angular 8.3.6
#schematics/update 0.803.6
rxjs 6.4.0
I can now create and start my project
ng new my-test-project
ng serve my-test project
I think SO should start getting serious about people down-voting questions or marking them as duplicates before reading them and even trying to understand what was asked and what the problem is.
It seems to be lots of people read the title and decide the fate of question just based on that and any disagreement ends up in blocking question entirely.
So much bias and hate on a site that is supposed to help.
Better alternatives are very much needed.
UPDATE
If you are like me and switched to use zsh shel instead of bash shell (since Catalina MacOs now uses zsh), you might have noticed that ng version has stopped working for you.
In that case, modify your .zshrc file by opening it in vim:
vi ~/.zshrc
In there, find this line:
source $ZSH/oh-my-zsh.sh
Underneath this line, add following line:
source /Users/Your-User-Name/.bash_profile
Save the file by hitting Esc key and typing :wq and hitting Enter
Restart your terminal
Reissue ng version and you should see it in your zsh shell:
If all the above methods doesn't work, then install angular-cli with Homebrew.
Run this in your Terminal (ZSH):
brew install angular-cli
Have a coffee, comeback and run this to test.
ng --version
Bingo.
The best solution is
alias ng="/Users/YourName/.npm-global/bin/ng"
Environment variable for "ng" may not be created. We can create it manually using the following steps:
Check if "ng" alias is present by opening your bash profile
touch ~/.bash_profile; open ~/.bash_profile
If there is no alias for "ng" found, Add the following alias in the bash file and save it
alias ng=/usr/local/Cellar/node/13.5.0/lib/node_modules/#angular/cli/bin/ng
Note: #angular/cli was installed under the following path for me
/usr/local/Cellar/node/13.5.0/lib/node_modules/#angular/cli. So I have added ng which is present under angular cli to the alias.
Now, check the ng version using
ng --version
This worked for me.
This is what worked for me, to fix this error
~ ng --version
zsh: command not found: ng
fix:
export PATH="$HOME/.npm-global/bin:$PATH"
I had the same problem, but the solution was to just add to my $PATH.
On MacOS Mojave with zsh, #Angular/CLI was not getting added to $PATH. You can add it to your path just by appending to /private/etc/paths:
sudo vim /private/etc/paths
append /Users/my_user_name/node_modules/#angular/cli/bin or wherever you installed #Angular/CLI.
save (:wq) and restart shell.
ng version then works.
My terminal display zsh: command not found: ng ,in visconde terminal not found command ng and not Mac terminal, I saw that in bashrc there was a line with the export of the ng command, so I copied the export that was inside bash and pasted it into ˜/.zshrc and now it works!
Related
After updating conda I can no longer run commands such as conda list, I now see the following error when I try a conda command:
CommandNotFoundError: No command 'conda conda'
The conda update was performed like so:
$ conda update -n base -c defaults conda
Collecting package metadata: ...working... done
Solving environment: ...working... done
## Package Plan ##
environment location: C:\home\miniconda
added / updated specs:
- conda
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-4.6.9 | py37_0 1.7 MB
------------------------------------------------------------
Total: 1.7 MB
The following NEW packages will be INSTALLED:
pip pkgs/main/win-64::pip-19.0.3-py37_0
The following packages will be UPDATED:
conda 4.6.8-py37_0 --> 4.6.9-py37_0
Proceed ([y]/n)?
Downloading and Extracting Packages
conda-4.6.9 | 1.7 MB | ########## | 100%
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done
My .bashrc file has the following line in it, and it also results in the above error upon creation of a new git/bash console on Windows 10:
eval "$('/c/home/miniconda/Scripts/conda.exe' 'shell.bash' 'hook')"
Is the above part of the problem?
My PATH environment variable contains conda-related paths at the front:
$ echo $PATH
/c/home/miniconda/condabin:/c/home/miniconda/Scripts:...
$ which conda
/c/home/miniconda/Scripts/conda
$ ll /c/home/miniconda/condabin
total 16
-rw-r--r-- 2 James Adams 197121 1995 Mar 29 21:46 _conda_activate.bat
-rw-r--r-- 2 James Adams 197121 147 Mar 29 21:46 activate.bat
-rw-r--r-- 2 James Adams 197121 1063 Mar 29 21:46 conda.bat
-rw-r--r-- 2 James Adams 197121 530 Mar 29 21:46 conda_auto_activate.bat
-rw-r--r-- 2 James Adams 197121 649 Mar 29 21:46 conda_hook.bat
-rw-r--r-- 2 James Adams 197121 192 Mar 29 21:46 deactivate.bat
-rw-r--r-- 2 James Adams 197121 65 Mar 29 21:46 rename_tmp.bat
Can anyone suggest how to fix this issue?
This cropped up for me today too. It appears to be a bug in conda 4.6.9.
I deleted everything conda-related but C:\Users\[username]\Anaconda3 and C:\Users\[username]\Anaconda3\Scripts from my PATH and conda commands started working. I still couldn't run source activate [environment] in bash without getting:
CommandNotFoundError: No command 'conda conda'
So I downgraded to 4.6.8 with:
conda install conda=4.6.8
And it solved my problem.
I too have been getting this error. Just like Gregory Allan stated, downgrading conda to 4.6.8 fixed it for me, and everything would work as intended.
Another way of downgrading without running a command in the terminal is to use Anaconda Navigator, and then you can select the packages you want to update or downgrade.
I installed easy_install on mac wityh the following command:
curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python
After that I tried to install pip but couldn't.
After checking here is what I have in /usr/bin
$ ls -l easy*
-rwxr-xr-x 2 root wheel 925 7 Jan 2016 easy_install
-rwxr-xr-x 1 root wheel 454 7 Jan 2016 easy_install-2.6
-rwxr-xr-x 1 root wheel 461 7 Jan 2016 easy_install-2.7
Probably it does not work because I have 2 versions installed now. I am in the list of sudoers but even with sudo I cannot delete these files:
sudo rm -f easy_install-2.6
Password:
rm: easy_install-2.6: Operation not permitted
When I log in to this macbook there is my username and also Administrator which I do not have access to now.
Is there a way to be able to delete these files without having to wait until the person that has the password for Administrator comes back from vacation?
Here is my macbook info
System Version: OS X 10.11.6 (15G31)
Kernel Version: Darwin 15.6.0
Boot Volume: Macintosh HD
Thanks
I need compile some LEX/YACC files(*.l) under OS X. And GNU flex is needed as a scanner.
However, I was stuck while installing GNU flex.
Run brew install flex, but got an error:
Error: You must `brew link xz' before flex can be installed
Then I run brew link xz, still got an error:
Error: Could not symlink lib/pkgconfig/liblzma.pc
/usr/local/lib/pkgconfig is not writable.
How to install flex on OS X 10.10 correctly? Is this problem caused by my home brew?
Some details about my 'brew':
Run brew doctor
Warning: /usr/local/lib/pkgconfig isn't writable.
This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.
You should probably `chown` /usr/local/lib/pkgconfig
Run ls command
yeze#yezedeMacBook-Pro:~$ ls -la /usr/local/lib/pkgconfig
total 16
drwxr-xr-x 4 root wheel 136 Mar 31 2013 .
drwxr-xr-x 30 yeze admin 1020 Oct 1 21:05 ..
-rw-r--r-- 1 root wheel 405 Mar 30 2013 tcl.pc
-rw-r--r-- 1 root wheel 404 Mar 30 2013 tk.pc
This question is caused by brew.
When you got /usr/local/lib/pkgconfig is not writable., you should run:
chown [YourAccountName] /usr/local/lib/pkgconfig
Then follow the instruction, run brew link xz. You may get a response like that :Linking /usr/local/Cellar/xz/5.2.1... 53 symlinks created
Finally, try brew install flex again, it will work.
Best thanks #IKavanagh.
Ok, well it's just been one of those nights where you spend hours and hours trying to get something to work, and you just keep getting weird errors, so if someone could help me I would greatly appreciate. After hours of trying to update Maven from 3.0.4 to 3.1.1 or 3.2.2 I've decided it's just not going to happen (I've tried almost everything I can find online, but I'm afraid to try to do to much in terminal) and I'm trying to install homebrew to make it easier. When I try to do the normal homebrew install I get an error that says:
dyld: lazy symbol binding failed: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/git/bin/git
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___strlcpy_chk
Referenced from: /usr/local/git/bin/git
Expected in: /usr/lib/libSystem.B.dylib
Failed during: git init -q
So then, I tried to do the alternative install method, but at this point I'm just so annoyed, and I don't get what it wants me to do. If anyone could give me some at least kind of detailed explanation for what to do I would be extremely grateful.
Here's where I'm looking at alternative installs: https://github.com/Homebrew/homebrew/wiki/Installation
The problem is I don't even really know what they mean by "untar" and "extract."
Thanks so much to anyone who can help
When I enter
ls -l /usr/local | pbcopy
I get:
total 0
drwxr-xr-x 2 root wheel 68 Aug 11 03:34 apache-maven
drwxrwxr-x 81 root admin 2754 Jan 17 2014 bin
drwxrwxr-x 3 root admin 102 Feb 21 2013 etc
drwxr-xr-x 9 root wheel 306 Jul 25 14:54 git
drwxrwxr-x 3 root admin 102 Feb 21 2013 lib
drwxrwxr-x 4 root admin 136 Feb 20 2013 share
drwxr-xr-x 4 root wheel 136 Dec 14 2013 texlive
Edited
Ok, so let's do an alternative install of homebrew:
cd /usr/local
mkdir homebrew
curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
If that works, you just need to find the directory where the file brew is located and then add that to your PATH
So
find /usr/local -name brew
Let's suppose the previous command results in
/usr/local/homebrew/bin/brew
we take brew off the end (because we want to know its directory only) and we add that to the start of our PATH
export PATH=/usr/local/homebrew/bin:$PATH
Now we should be able to run
brew doctor
Also, we need to add that export PATH=.... command to our login sequence so our shell knows how to find brew every time we login. So add that line to the end of your ~/.profile
Original Answer
Ok, take a deep breath, and relax :-)
homebrew is a great choice on the Mac, so the pain should be worth it. I suspect you have a customised PATH and customised environment variables which are stopping the homebrew installation. You can either set your PATH and environment variables back to their default settings, or, if that is simpler, just add a new user to your Mac and log in as the new user with a standard environment and then install homebrew using the standard method.
To look at your PATH and environment variables, use these commands:
echo $PATH
set
or
set | grep -i LIB
to look for any customised DYLD_LIBRARY_PATH
Once you have it installed, try running
brew doctor
to check your setup before adding maven and other packages.
I am running ant 1.8.2 and I want to up date to the latest on my mac. What is the best way to do this? Should I remove then install or can i write over the previous?
I use it in both Eclipse and from the command line. I also have jenkins call ant targets. It's currently set in /usr/local
I found these two links to update Ant on mac:
Seventy6.com
Ninjascript.com
I had Ant 1.8.4 installed on my Mac 10.8.5 and upgraded to:
Apache Ant(TM) version 1.9.4 compiled on April 29 2014
The first website from seventy6 said all of the below, with a few updates from myself.
To see what version you currently have installed run this:
$ ant -version
Apache Ant version 1.7.1 compiled on February 11 2010
I was advised to use the simple OSX package installer homebrew. I’m not going to discuss how to install this, as they have a really simple guide. However, it’s not obvious how to install Apache Ant as it’s not one of the packages they list. So here is the brew to get started:
$brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/ant.rb
EDIT: You can also just install now with homebrew just by typing the following
$brew install ant
Beware, you might need to install Apple’s XCode, which if you’re still running OS X 10.6 or lower (like me) you can’t install the latest version (4) via the wonderful (?) AppStore. Ha! fun and games! Luckily, I have an Apple Developer account which allows you to download archived releases of Apple’s software. I created this ages ago and assume they’re still free to do… Once installed it puts the package here:
/usr/local/Cellar/ant/1.8.2
I then scratched my head for a while as to how to get OSX to use the newly installed version. It seems the easiest option is to remove the symlink currently set for the system. Run this to see where this is:
$ whereis ant
/usr/bin/ant //returned message
So we need to remove the symlink and set it to our new installed copy. I found this article which got me started. Useful, but not perfect for a homebrew package install. So here is the final commands to change the symlink to the homebrew version:
$ cd /usr/share
$ sudo rm /usr/share/ant
Password:
************
$ ln -s /usr/local/Cellar/ant/1.8.2 ant
You now need to close your current terminal session and open a new one. In theory you should be able to run 'ant -version' to get the latest version…
$ ant -version
Apache Ant(TM) version 1.8.2 compiled on December 20 2010
I’m not sure if it’s best way to do it. But it’s a simple technique which can easily be updated if needed. At least you haven’t removed the base Java install of Ant from your system!
DONE
Also from blog.ninjascript.com, I saw this was interesting to know about:
Now Ant is kind of buried in OS X; the $PATH variable points to a symlink which points to another symlink. To find out where ant really is, just follow the chain:
$ which ant
/usr/bin/ant
$ ls -la /usr/bin/ant
lrwxr-xr-x 1 root wheel 22 Nov 11 18:04 /usr/bin/ant -> /usr/share/ant/bin/ant
$ ls -la /usr/share/ant
lrwxr-xr-x 1 root wheel 14 Nov 11 18:04 /usr/share/ant -> java/ant-1.7.1
$ ls -la /usr/share/java/ant-1.7.1
total 40
drwxr-xr-x 8 root wheel 272 Feb 27 12:32 .
drwxr-xr-x 8 root wheel 272 Nov 11 18:04 ..
-rw-r--r-- 1 root wheel 15289 Feb 10 2010 LICENSE.txt
-rw-r--r-- 1 root wheel 1270 Feb 10 2010 NOTICE.txt
drwxr-xr-x 8 root wheel 272 Feb 10 2010 bin
drwxr-xr-x 3 root wheel 102 Feb 10 2010 docs
drwxr-xr-x 15 root wheel 510 Feb 10 2010 etc
drwxr-xr-x 44 root wheel 1496 Feb 27 12:09 lib