Building Ambari 2.7.5 on CentOS 7 from source, Worked 2 weeks ago, now fails - ambari

Followed instructions here: Ambari 2.7.5 installation failure on CentOS 7
I followed the exact same instructions and am now getting this from ambari-admin section of the build:
[INFO] --- exec-maven-plugin:1.2.1:exec (Bower install) # ambari-admin ---
bower angular-route#*
bower angular-route#*
bower underscore#1.7.0
bower underscore#1.7.0
bower bootstrap#3.3.7
bower bootstrap#3.3.7
bower angular-mocks#*
bower angular-mocks#*
bower angular#*
bower angular#*
bower font-awesome#4.2.0
bower font-awesome#4.2.0
bower angular-translate#*
bower angular-translate#*
bower chai#1.8.0
bower chai#1.8.0
bower mocha#1.14.0
bower mocha#1.14.0
bower angular-animate#*
bower angular-animate#*
bower angular-bootstrap-toggle-switch#0.5.1
bower angular-bootstrap-toggle-switch#0.5.1
bower restangular#1.4.0
bower restangular#1.4.0
bower commonjs#0.2.0
bower commonjs#0.2.0
bower sinon#1.10.3
bower sinon#1.10.3
bower angular-bootstrap#0.11.0
bower angular-bootstrap#0.11.0
bower angular#>=1.2.26 <1.8
bower angular#>=1.2.26 <1.8
bower lodash#>=1.3.0 <2.5.0
bower lodash#>=1.3.0 <2.5.0
bower angular#>=1
bower angular#>=1
bower jquery#1.9.1 - 3
bower jquery#1.9.1 - 3
bower ECONFLICT Unable to find suitable version for angular
I can supply the entire stack if necessary.
Questions I have are:
1. Why did the project build 2 weeks ago and with absolutely no changes now fails with the above stack?
2. What to do to fix this?
Really appreciate any input or help.
As requested, here are the steps that I followed:
1. Using lxc to create centOS 7 x86_64 environment:
lxc launch images:centos/7/amd64 cent7
2. Attach to that kernal, this logs you in as root in a bash shell
lxc exec cent7 bash
3. Install necessary packages
yum install -y which
yum install -y wget
yum install -y rpm-build*
yum install -y gcc*
yum install -y git*
yum install -y python-devel*
yum install -y maven
(This installs an old version,3.0.5, but takes care of all dependencies such as java)
Get latest version of maven, Ambari build needs at least 3.3.9
mkdir /maven363 ; cd /maven363
wget http://mirror.cogentco.com/pub/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
tar zxf apache-maven-3.6.3-bin.tar.gz
## Setup paths to this maven in .bashrc file
vi ~/.bashrc
export PATH=/maven363/apache-maven-3.6.3/bin:$PATH
export _JAVA_OPTIONS="-Xmx2048m -XX:MaxPermSize=512m -Djava.awt.headless=true"
## Instantiate the above .bashrc changes
. ~/.bashrc
Get python tools for python 2.7
mkdir /PythonTools ; cd /PythonTools/
wget https://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg#md5=fe1f997bc722265116870bc7919059ea
sh setuptools-0.6c11-py2.7.egg
4. Get the Ambari source code
mkdir /Ambari275 ; cd /Ambari275
wget https://www-eu.apache.org/dist/ambari/ambari-2.7.5/apache-ambari-2.7.5-src.tar.gz
5. Untar the file
tar zxf apache-ambari-2.7.5-src.tar.gz
6. Fix the ambari-admin pom.xml file to load the correct versions of npm and node.js (This module had compilation errors),
Found fix information here:
https://stackoverflow.com/questions/61542102/ambari-2-7-5-installation-failure-on-centos-7
cd /Ambari275/apache-ambari-2.7.5-src/ambari-admin
vi pom.xml
From:
<nodeVersion>v4.5.0</nodeVersion>
<npmVersion>2.15.0</npmVersion>
To:
<nodeVersion>v6.17.1</nodeVersion>
<npmVersion>3.10.10</npmVersion>
7. Now follow all instructions here:
https://cwiki.apache.org/confluence/display/AMBARI/Installation+Guide+for+Ambari+2.7.5

Q1: Something must have changed in your build environment. Either way, if the versions in the build environment are not ideal, the dependencies deeper in the entire project have conflicts.
Q2: The solution you are looking for is to modify the following file:
nano ambari-admin/src/main/resources/ui/admin-web/bower.json
The contents should be:
{
"name": "adminconsole",
"private": true,
"dependencies": {
"bootstrap": "3.3.7",
"angular": "1.3.0",
"angular-route": "1.3.0",
"angular-bootstrap": "0.11.0",
"underscore": "1.7.0",
"restangular": "1.4.0",
"angular-bootstrap-toggle-switch": "0.5.1",
"angular-animate": "1.3.0",
"angular-translate": "~2.8.1",
"font-awesome": "4.2.0"
},
"devDependencies": {
"angular-mocks": "1.3.0",
"commonjs": "0.2.0",
"chai": "1.8.0",
"mocha": "1.14.0",
"sinon": "1.10.3"
}
}
And the build environment has the following versions:
npm -v
6.14.4
node -v
v10.21.0
python -V
Python 2.7.18
mvn -v
Apache Maven 3.6.3
You may need to play around with the angular version(s). The snippet I posted above is one that worked for me today in a different operating system (SUSE / openSUSE). I do not get this error in centos. I have authored and participated in some of the recent SO threads on it so getting pretty deep in Ambari 2.7.5 from Source.

Related

How to install yo on node#12 and npm#6.9.0 with zshrc via homebrew

I have been trying to install yo to integrate and test botkit but had issues with yo and npm and node as I updated brew on my mac to the latest. Here is how I resolved it.
If you have installed latest node 12 on your mac using latest update of homebrew(if you haven't updated and want to, please update brew by running brew update and run brew install node).
Run the following commands to verify node and npm are updated to 12 and 6.9.0
[keshav#xxxxxx-mbp ~ ]$node -v
v12.1.0
[keshav#xxxxxx-mbp ~ ]npm -v
6.9.0
If this is what you see on your console, you are good to proceed to next steps.If not, please add a comment if you are facing a error.
Run the following commands
echo export PATH="$HOME/npm/bin:$PATH" >> ~/.zshrc
npm config set prefix ~/npm
echo "export NODE_PATH=$NODE_PATH:/home/$USER/npm/lib/node_modules" >> ~/.zshrc && source ~/.zshrc
npm install -y -g yo
Once you run the command in step 4, you should see the below output in the console.
Output of command 4
npm install -y -g yo
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/Users/xx/npm/bin/yo-complete -> /Users/xx/npm/lib/node_modules/yo/lib/completion/index.js
/Users/xx/npm/bin/yo -> /Users/xx/npm/lib/node_modules/yo/lib/cli.js
yo#2.0.6 postinstall /Users/xx/npm/lib/node_modules/yo
yodoctor
Yeoman Doctor
Running sanity checks on your system
✔ Global configuration file is valid
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
✔ NODE_PATH matches the npm root
✔ yo version
Everything looks all right!
+ yo#2.0.6
updated 1 package in 5.752s

Command not found with vue-cli

While installing the dependencies of vue-cli, vue is not identified. Why?
rm -rf node_modules and npm install again
have a look here
Add sudo before yarn when installing
yarn global remove #vue/cli
sudo yarn global add #vue/cli
vue
I had the same issue for a while.
TL;DR
npm install #vue/cli-service --save-dev
As the documentation specify it is a development dependency https://cli.vuejs.org/guide/#cli-service
The CLI Service (#vue/cli-service) is a development dependency. It's an npm package installed locally into every project created by #vue/cli.
Origin
I had a fresh install of nodejs
And just did
>> sudo npm install -g #vue/cli#latest
>> vue --version
#vue/cli 4.5.8
The issue
The issue presented like this
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
/bin/sh: 1: vue-cli-service: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The fixes:
npm install #vue/cli-service --save-dev
Which led me straight to another error message
>> npm run serve
yarn run v1.22.10
$ vue-cli-service build --mode development --watch
ERROR Error: Cannot find module 'vue-template-compiler/package.json'
Which I fixed the same way
npm i vue-template-compiler --save-dev
And now it is working fine.
Installing current version without permanently installing vue-cli.
npx #vue/cli create appname
It shows the vue executable is located at /home/alisha/.local/bin. So probably this location is not there in your $PATH.
You should be able to run the vue commands if you provide the full path, like:
~/.local/bin/vue create hello-world
You can also see if that directory is in your PATH by running some command like:
echo $PATH | grep '.local/bin/'
If it's there, you would see it, otherwise you can add it to your path by placing it in your ~/.profile.
Edit ~/.profile and add the following at the bottom of it.
PATH="$HOME/.local/bin:$PATH"
Hope it helps!!
I had the same issue while making a build for production.
You will require vue-cli to be installed. Use below command to install the latest version.
npm install -g #vue/cli#latest
Then
npm install
Might have to do with you having an old version on your computer:
Warning regarding Previous Versions
The package name changed from vue-cli to #vue/cli. If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with
npm uninstall vue-cli -g or yarn global remove vue-cli.
You can find it here: https://cli.vuejs.org/guide/installation.html
THIS FIXED THE ISSUE FOR ME:
After running
sudo npm install -g #vue/cli
I ran
sudo nano $HOME/.profile
and pasted the following line
export PATH=$PATH:/home/chike/.npm-global/bin
after writing the code, next thing I did was Ctrl + O, ENTER and Ctrl + X then wrote
vue init webpack myapp
When you install vue using cli that time you got the path of vue.Now you can copy the bin folder path.
In my example /home/sublime/.npm-packages/bin
Now you export the path below command
export PATH=$PATH:/home/sublime/.npm-packages/bin
I solved mine by running (add sudo if needed)
npm i -g vue-cli#2.9.6
npm i -g #vue/cli
Got similar issue when deploy vue project in jenkins.
Here is what I did:
Add node's bin/ dir, to jenkins user's .bashrc file.
e.g
# node
NODE_HOME=/home/dev/.nvm/versions/node/default
PATH=$NODE_HOME/bin:$PATH
Tips - about nvm & yarn
When you manage node version via nvm, make sure you already choose the node version in terminal. e.g:
nvm use stable
node -v
If you use nvm, and installed yarn via npm, then better install vue-cli via npm not yarn, otherwise the vue executable is not placed into node's bin/ dir, at least that's the case in my tests, and as a result will cause you fail to find the vue command.
Using Yarn on Ubuntu it is installed to ~/.npm-packages/bin/. You must add this directory to your PATH. For example run the following command, close your terminal and open a new one.
user#machine:~$ echo 'export PATH="$PATH:~/.npm-packages/bin/"' >> ~/.bashrc
Note: if the file ~/.bashrc does not exist then simply create it.
Following worked for me:
First remove all the existing ones:
yarn global remove #vue/cli
yarn global remove #vue/cli-service
sudo yarn global remove #vue/cli
sudo yarn global remove #vue/cli-service
Then add #vue/cli using sudo:
Note: use sudo if required
yarn global add #vue/cli
yarn global add #vue/cli-service
Then, the final thing to do is to RESTART the terminal.
vue --version
#vue/cli 4.5.9
If you already got a project, the only two things you need to do is:
Delete the directory node_modules (it is safe, since it is not under git and will regenerate in the next step)
In the command-line write yarn install (it will install everything you need)
If you start installing vue-cli manually in a existing project, it the package.json and package-lock.json will be updated. If you already did. Do a checkout from git, and follow my steps above
This may be a problem caused by version conflicts. "export PATH=$PATH:" This is really useful in some cases. But if you are also like me, after trying the direct “export path” method in the comment above, restarting the terminal still can not execute the situation, you can try this way.
Uninstall Vue
npm uninstall -g #vue/cli
Check the local-global npm package installation path, vue is installed in this directory, check if it has been removed.
npm root -g
Install vue (you can check with https://cli.vuejs.org/#getting-started to find the latest command)
npm install -g #vue/cli
Create a connection to the /usr/local/bin directory(You need to find the vue.js path after the local installation first, then replace this path with your latest local install path:/Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js)
ln -s /Users/xxxxx/.npm-global/lib/node_modules/#vue/cli/bin/vue.js /usr/local/bin/vue
View version number
vue -v
I was getting the same error because Node.js was not installed. My issue got resolved by installing Node.js using the following command:
sudo apt install nodejs-legacy
To see if you already have Node.js and npm installed and check the installed version, run the following commands:
node -v
npm -v
If both are installed then follow the steps here:
https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
I installed the package using yarn global add #vue/cli on my Ubuntu box and found the binary in /home/vonkad/.yarn/bin.
I had to modify my /home/vonkad/.bashrc and add the directory to the path export PATH=$PATH:/home/vonkad/.yarn/bin.
To fix this situation, I had to add the following line to my .zshrc (maybe in your case is .bashrc)
export PATH="$(yarn global bin):$PATH"
Effectively, the yarn global bin is a folder where vue (vue-cli 3) was placed.
What helped me
mac os catalina with zsh terminal
Uninstalled node and npm using https://www.positronx.io/how-to-uninstall-node-js-and-npm-from-macos/
Downloaded node/npm from https://nodejs.org/en/download/current/
sudo npm install -g #vue/cli
vue --version (#vue/cli 4.5.4)
I faced the same issue and now resolved. In my case I installed Node.js and NPM using the default Ubuntu repository by using this command sudo apt-get install nodejs npm
The problems seemed like those 2 packages are not well maintained so it caused some bugs.
So I purge those packages and reinstall it from nodesource which is officially recommended way to install (reference: Installation instruction from nodesource) using these commands.
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Then reinstall #vue/cli again
sudo npm install -g #vue/cli
Now these issues have gone. Hope it helps some programmers.
You need to install vue via sudo like explained in the doc:
https://cli.vuejs.org/guide/installation.html
If you have WSL2 running and you use zsh like me, just add
yarn global add #vue/cli
# add this line to ~/.zshrc
export PATH="$HOME/.yarn/bin:$PATH"
$ vue --version
#vue/cli 4.x.xx
You can try the following code install see
npm install --global vue-cli
vue init webpack <YOUR-PROJECT-NAME-HERE>
cd <YOUR-PROJECT-NAME-HERE>
npm install
npm run dev

How do I correctly upgrade angular 2 (npm) to the latest version?

Recently I started Angular 2 tutorial at https://angular.io/docs/ts/latest/tutorial/.
and left off with Angular 2 beta 8.
Now I resumed the tutorial and latest beta is beta 14.
If I simply do npm update a few modules (preloaded with the tutorial) are updated but not Angular2 (I can see that with npm ls).
If I do npm update angular 2 or npm update angular2#2.0.0beta.14 it just does nothing either.
The command npm update -D && npm update -S will update all packages inside package.json to their latest version, according to their defined version range. You can read more about it here.
If you want to update Angular from a version prior to 2.0.0-rc.1, then you'll need to manually edit package.json, as Angular was split into several npm modules. Without this, as angular2 package points to 2.0.0-beta.21, you'll never get to use the latest version of Angular.
A list with some of the most common modules that you'll need to get started can be found in the quickstart repository.
Notes:
A cool way to stay up to date with your packages' latest version is to use npm outdated which shows you all outdated packages together with their wanted and latest version.
The reason why we need to chain two commands, npm update -D and npm update -S is to overcome this bug until it's fixed.
Another nice package which I used for migrating form a beta version of Angular2 to Angular2 2.0.0 final is npm-check-updates
It shows the latest available version of all packages specified within your package.json. In contrast to npm outdated it is also capable to edit your package.json, enabling you to do a npm upgrade later.
Install
sudo npm install -g npm-check-updates
Usage
ncufor display
ncu -u for re-writing your package.json
Upgrade to latest Angular 5
Angular Dep packages:
npm install #angular/{animations,common,compiler,core,forms,http,platform-browser,platform-browser-dynamic,router}#latest --save
Other packages that are installed by the angular cli
npm install --save core-js#latest rxjs#latest zone.js#latest
Angular Dev packages:
npm install --save-dev #angular/{compiler-cli,cli,language-service}#latest
Types Dev packages:
npm install --save-dev #types/{jasmine,jasminewd2,node}#latest
Other packages that are installed as dev dev by the angular cli:
npm install --save-dev codelyzer#latest jasmine-core#latest jasmine-spec-reporter#latest karma#latest karma-chrome-launcher#latest karma-cli#latest karma-coverage-istanbul-reporter#latest karma-jasmine#latest karma-jasmine-html-reporter#latest protractor#latest ts-node#latest tslint#latest
Install the latest supported version used by the Angular cli (don't do #latest):
npm install --save-dev typescript#2.4.2
Rename file angular-cli.json to .angular-cli.json and update the content:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "project3-example"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
UPDATE:
Starting from CLI v6 you can just run ng update in order to get your dependencies updated automatically to a new version.
With ng update sometimes you might want to add --force flag.
If you do so make sure that the version of typescript you got
installed this way is supported by your current angular version,
otherwise you might need to downgrade the typescript version.
Also checkout this guide Updating your Angular projects
For bash users only
If you are on are on Mac/Linux or running bash on Windows(that wont work in default Windows CMD) you can run that oneliner:
npm install #angular/{animations,common,compiler,core,forms,http,platform-browser,platform-browser-dynamic,router,compiler-cli}#4.4.5 --save
yarn add #angular/{animations,common,compiler,core,forms,http,platform-browser,platform-browser-dynamic,router,compiler-cli}#4.4.5
Just specify version you wan't e.g #4.4.5 or put #latest to get the latest
Check your package.json just to
make sure you are updating all #angular/* packages that you app is relying on
To see exact #angular version in your project run:
npm ls #angular/compiler or yarn list #angular/compiler
To check the latest stable #angular version available on npm run:
npm show #angular/compiler version
Official npm page suggest a structured method to update angular version for both global and local scenarios.
1.First of all, you need to uninstall the current angular from your
system.
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
npm uninstall -g #angular/cli
2.Clean up the cache
npm cache clean
EDIT
As pointed out by #candidj
npm cache clean is renamed as npm cache verify from npm 5 onwards
3.Install angular globally
npm install -g #angular/cli#latest
4.Local project setup if you have one
rm -rf node_modules
npm install --save-dev #angular/cli#latest
npm install
Please check the same down on the link below:
https://www.npmjs.com/package/#angular/cli#updating-angular-cli
This will solve the problem.
Alternative approach using npm-upgrade:
npm i -g npm-upgrade
Go to your project folder
npm-upgrade check
It will ask you if you wish to upgrade the package, select Yes
That's simple
If you want to install/upgrade all packages to the latest version and you are running windows you can use this in powershell.exe:
foreach($package in #("animations","common","compiler","core","forms","http","platform-browser","platform-browser-dynamic","router")) {
npm install #angular/$package#latest -E
}
If you also use the cli, you can do this:
foreach($package in #('animations','common','compiler','core','forms','http','platform-browser','platform-browser-dynamic','router', 'cli','compiler-cli')){
iex "npm install #angular/$package#latest -E $(If($('cli','compiler-cli').Contains($package)){'-D'})";
}
This will save the packages exact (-E), and the cli packages in devDependencies (-D)
Just start here:
https://update.angular.io
Select the version you're using and it will give you a step by step guide.
I recommend choosing 'Advanced' to see all steps. Complexity is a relative concept - and I don't know whose stupid idea this feature was, but if you select 'Basic' it won't show you all steps needed and you may miss something important that your otherwise 'Basic' application is using.
As of version 6 there is a new Angular CLI command ng update which intelligently goes through your dependencies and performs checks to make sure you're updating the right things :-)
The steps will outline how to use it :-)
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
ng update #angular/cli
ng update #angular/core --force
ng update #angular/material or npm i #angular/cdk#6
#angular/material#6 --save
npm install typescript#'>=2.7.0 <2.8.0'
Best way to do is use the extension(pflannery.vscode-versionlens) in vscode.
this checks for all satisfy and checks for best fit.
i had lot of issues with updating and keeping my app functioining unitll i let verbose lense did the check and then i run
npm i
to install newly suggested dependencies.
If you are looking like me for just updating your project to the latest these is what works form me since Angular 6:
Open the console on your project folder: If you type: ng update then you will get the below message:
We analyzed your package.json, there are some packages to update:
Name Version Command to update
--------------------------------------------------------------------------------
#angular/cli 7.0.7 -> 7.2.2 ng update #angular/cli
#angular/core 7.0.4 -> 7.2.1 ng update #angular/core
There might be additional packages that are outdated.
Run "ng update --all" to try to update all at the same time.
So I usually go straight and do:
ng update --all
Finally you can check your new version:
ng version
Angular CLI: 7.2.2
Node: 8.12.0
OS: win32 x64
Angular: 7.2.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.12.2
#angular-devkit/build-angular 0.12.2
#angular-devkit/build-optimizer 0.12.2
#angular-devkit/build-webpack 0.12.2
#angular-devkit/core 7.2.2
#angular-devkit/schematics 7.2.2
#angular/cli 7.2.2
#ngtools/webpack 7.2.2
#schematics/angular 7.2.2
#schematics/update 0.12.2
rxjs 6.3.3
typescript 3.2.4
webpack 4.28.4

How to install bower on openshift.redhat? "No compatible version found"

I am testing openshift.redhat free plan. Until now, things were somewhat going fine with my deploy, until I tried installing bower. Search through the internet, some people advised on the following recipe:
HOME=$OPENSHIFT_DAT_DIR # as you cannot write to the home folder
npm install bower
With the following, I get a
No compatible version found for abbrev;
So, did anyone managed to install bower with redhat openshift?
Command line utilities that are usually installed using the -g or --global flag will be automatically be added to the system $PATH, as long as they are included in the dependencies or devDependencies sections of the project’s package.json file.
https://developers.openshift.com/en/node-js-dependency-management.html
This means that if you include bower in your package.json, you will be able to use bower like normal in your application.
"dependencies": {
"bower": "^1.4.1",
}
I found running bower more difficult...
I managed to get bower running by adding this in my package.json
"scripts": {
"postinstall": "HOME=$OPENSHIFT_REPO_DIR bower install || bower install"
}
It works on both my local machine AND Openshift.
Hope this helps

Problems updating bower to the latest version

I am using bower
$ bower -v
0.9.2
latest version of bower is 1.x.x
https://github.com/bower/bower/releases
I run to update bower to the latest version
npm update -g bower
this does not help
I still have
$ bower -v
0.9.2
1) you have to clear npm cache and then update bower
sudo npm cache clean
npm update -g bower
2) If 1st solution does not help
try to remove and install it again
npm -g uninstall bower
npm -g install bower
check if it is still here
which bower
if it will show you something like
/usr/local/bin/bower
then
rm <path from previous command>
and after install it again
npm -g install bower
open new bash window and enjoy latest version of bower
same will help with other packages
There could be a lot of moving parts here. First you should try
npm cache clean
sudo npm cache clean
npm update -g bower
…which is –given all the moving parts– not very likely to work for you.
On Mac, using brew and nvm with some history, you would do something like this:
1. figure out where bower is now
$ which bower
/usr/local/share/npm/bin/bower
$ ls -hal /usr/local/share/npm/bin/bower
lrwxr-xr-x 1 iwein admin 35B Dec 15 2013 /usr/local/share/npm/bin/bower -> ../lib/node_modules/bower/bin/bower
$ ls -hal /usr/local/share/npm/lib/node_modules/bower/bin/bower
-rwxr-xr-x 1 iwein staff 3.3K Sep 17 2013 /usr/local/share/npm/lib/node_modules/bower/bin/bower
$ bower -v
1.2.8
$ rm -rf /usr/local/share/npm/lib/node_modules/bower
2. reinstall bower using npm
$ npm install -g bower
/Users/iwein/.nvm/v5.11.1/bin/bower -> /Users/iwein/.nvm/v5.11.1/lib/node_modules/bower/bin/bower
/Users/iwein/.nvm/v5.11.1/lib
└── bower#1.7.9
$ bower -v
bash: /usr/local/share/npm/bin/bower: No such file or directory
$ which bower
/Users/iwein/.nvm/v5.11.1/bin/bower
$ bower
bash: /usr/local/share/npm/bin/bower: No such file or directory
$ ls -hal ~/.nvm/v5.11.1/bin/bower
lrwxr-xr-x 1 iwein staff 35B Jun 1 11:53 /Users/iwein/.nvm/v5.11.1/bin/bower -> ../lib/node_modules/bower/bin/bower
3. open a new terminal
…or source your .profile or whatever. Check if you're using the same node version (implying a different nvm version if you don't)
$ which bower
/Users/iwein/.nvm/v0.10.24/bin/bower
$ bower -v
1.4.1
$ nvm use 5
Now using node v5.11.1
$ which bower
/Users/iwein/.nvm/v5.11.1/bin/bower
$ bower -v
1.7.9
And you're good.
Note that:
you have to make sure you are installing in the right place, you may need multiple versions of bower, nvm, npm or node on your system for different projects…
you need to restart the terminal to make sure the linking is done correctly.
Probably the bower update worked fine, it's just missing update environment var.
On my Ubuntu was something like:
ln -sf /usr/local/n/versions/node/6.2.0/bin/bower /usr/bin/bower