Problems updating bower to the latest version - npm

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

Related

How to use the brew version of a command (aws-es-proxy) instead of node?

I used npm -i -g aws-es-proxy. But I actually wanted to do brew install aws-es-proxy because the commands are slightly different for these two packages depending on whether installed with npm or brew. So I did npm uninstall -g aws-es-proxy and after uninstalling and deleting the folder that was still left over
$ cd /Users/USER_NAME/.nvm/versions/node/v10.17.0/bin/
$ ls
aws-azure-login node npm npx
bin USER_NAME$ rm -r aws-azure-login
I still would get
$ aws-es-proxy -listen :9200 -ENDPOINT
-bash: /Users/USER_NAME/.nvm/versions/node/v10.17.0/bin/aws-es-proxy: No such file or directory
It seems like this terminal is using npm version instead of brew version. Can you let me know how I can force to use the brew installation for this command?
Actually, all I had to do was open a new terminal session and it recognized the command. Not sure what behind the scenes stuff was happening.

How install and run vue js application on Centos 7

I want to install vuejs and run it on Centos 7, I want to run it inside a specific folder.
[updated]
It's a little bit different, but works fine to me on CentOS 7
(deprecated but working fine)
$ curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
$ sudo yum install -y nodejs
$ node --version
$ npm --version
$ sudo npm install -g #vue/cli
$ vue create [projectname]
go to the folder of project name:
$ cd projectname
$ npm run serve
open your internet browser and type http://localhost:8080/
You need to install Node and NPM first. On CentOS 7 you can do this by running the following commands.
curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -
sudo yum install nodejs
After this, confirm that Node and NPM are installed by running node --version and npm --version.
Then you need to install vue-cli. This makes creating Vue applications very easy. Install it by running npm install -g #vue/cli. After that has installed, you can create new projects by running vue create <project-name>. Once you have created the project, you can run it locally using npm run serve.

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

What npm install -s mean?

I am installing some packages on NPM, sometimes I have to write -s and -g? What do they mean?
npm install -s socket.io
npm install -g xxxxxxx
npm -g <package> will install a package globally on your machine. Without the -g or --global flag, the package will be installed locally in the directory you were in when you ran the command.
npm -S <package> with an uppercase -S or --save will install the package and save it to your dependencies in your package.json, although I believe that is now the default behavior in current npm. I recommend reading the docs if you're unfamiliar with what's happening when you pass different options to npm.
#gmmetheny answered the question about the global -g flag, but -s appears to silence the output of the command (at least in npm v7.0.15).
In other words, including -s (or --silent) in your npm install command means that it will have no output (only a newline):
> npm install -s example-package1 example-package2
This may be useful for running the command in a script.
Running the command without the -s flag echoes information about what was installed, e.g.:
> npm install example-package1 example-package2
npm WARN deprecated some-pkg#1.2.3: this library is no longer supported
added 160 packages, and audited 160 packages in 6s
14 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
You can diff the resulting directories created after running each variant of the command and you can verify that the effects are the same.
As #Max mentioned, this option is NOT mentioned in the npm docs (at least not in any prevalent location where a user might find it after a reasonable amount of searching).

npm install runs correctly, but cannot run topojson

If I do:
npm init
npm install --save topojson
I end up with a package.json file and node_modules directory, all looking correct. But if I then do:
topojson
I see:
-bash: topojson: command not found
Why?
The answer to this issue turned out not to be related to npm - npm install topojson no longer installs a command-line tool called topojson. Confusingly, it used to, but the package has changed.
try this step
install globally using -g
1. install nodejs http://nodejs.org/
2. install npm https://npmjs.org/doc/README.html
3. run npm install -g topojson in your command prompt
4. use the command prompt to cd to the geojson file
5. run topojson -o myNewTopojsonFile.json myOldGeojsonFile.json