Uninstalling bower installed with a different version of npm - node.js

I have an Ubuntu 14.04 system. I had installed npm and I installed bower using
sudo npm install -g bower
Some time after that I realized that I was using the node and npm that came fromt he ubuntu repositories, so to use the latest one, I added the repository:
$ sudo add-apt-repository ppa:chris-lea/node.js
and update the packages.
Now I was trying to uninstall bower from the system, but guess what? I get this:
$ sudo npm remove -g bower
npm WARN uninstall not installed in /usr/lib/node_modules: "bower"
So, wait, what? It cant find Bower? So I try to make
which bower
and the output here is:
/usr/local/bin/bower
I dont really understand what is going on. I suspect that I have a problem with different versions of npm and nodejs not playing nice together, since I installed bower with a different version of npm that the one I have installed now. Any idea of how I could uninstall Bower now? (Or at least come back to a clean state, so that I can begin from the beginning?)

sudo npm uninstall bower -g --prefix=/usr/local

Related

Installing lodash.filter

What is the difference between npm install and npm install --save?
I try to install lodash.filter using npm install --save lodash.filter. I thought it install the packet + describes it in package.json.
But the system says, she do not understand, what lodash.filter is.
Should I install lodash.filter again using npm install lodash.filter? Or what should I do? Uninstalling lodash.filter and trying to install it again?
To check installed modules use npm ls to show all your modules and npm ls lodash.filter to see, if it is installed. I think the system showed the mistake, because imported lodash.filter wasn't used in program (I followed the other steps in the tutorial and it rendered well).

npm does not support Node v10.16.0 but my version of npm does

Getting a warning that
npm does not support Node.js v10.16.0.
However my version of npm is 6.9.0 which is the version that is tied to 10.16.0.
I've tried all the suggestions here on such as sudo npm uninstall -g npm but still getting the same error as the version that is reinstalled is 6.9.0
A full remove and install just gets me back to the original issue. Please stop suggesting brew uninstall node
Even a complete uninstall outlined below did not do the trick for longer than a day. I guess I'll just have to live with the issue. There does not seem to be a fix.
The best solution in your case is to uninstall both node and npm fully, and then reinstall the node which will bring the matching npm version. Using Node Version Manager can simply node and npm version management a lot.
Manually uninstall:
sudo apt-get remove nodejs
sudo apt-get remove npm
Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a
sudo apt-get update
This answer describes it all.

sudo: npm: command not found, while running npm with sudo

I installed nodejs v8.11.2 and npm v5.6.0 using the command nvm install 8.11.2.
When I opened my system after shutting it down for a while my system and wrote npm -v in the terminal, it said npm is not installed, and to install it with sudo apt install npm.
However when I again entered nvm install 8.11.2, it said that nodejs and npm are already installed and it began using it. Sometimes when opening a different terminal, npm -v says that npm is not installed. And later when I used the command sudo npm install, the output came:
sudo: npm: command not found
So I installed npm with sudo apt-get install npm, but it installed npm v3.5.2 and updating it with npm install npm#latest -g did nothing, i.e., it remained npm v3.5.2.
I need npm v5.6.0 for a project of mine and is clueless on how to get this issue sorted. Please help.
(nvm maintainer here)
sudo is not, and must not be, used with nvm. nvm is per-user, per-shell.
npm should not be installed by itself; it comes with node. You should apt-get remove it.
If nvm isn't being loaded properly on a new shell, try rerunning the install script, then file an issue on http://nvm.sh, and I'll be happy to help you directly.

How to properly upgrade npm on debian when installed with apt

I have issue with jessie and npm.
I have installed package nodejs with sudo apt-get install nodejs, so it installed npm automatically.
I then want to install latest of npm using npm i -g npm#latest, which work fine except the apt npm version is conflicting.
I want to remove the conflicting apt installed version, or to know the official way to update npm, if installed from apt.
I am only able to update node using npm i -g n then n stable but it is impossible for me to upgrade npm
npm is distributed with Node.js- which means that when you download Node.js, you automatically get npm installed on your computer.
A quote from The npm Blog
The best way to install npm is to install node using the node.js installer. npm is installed as part of node.
It’s over at nodejs.org. It will give you a recent, working version of npm with all the paths in the expected places. This is the version that npm Inc and the Node.js project both support.
Once you’ve installed Node.js, you can make sure you’ve got the very most recent version of npm using npm itself by running this:
npm install npm -g
If you have issues, do not use sudo, read in documentation fixing npm permissions carefully and configure npm properly.

NPM Install is not installing dependencies

I'm attempting to install the Ushahidi V3 Client. I've been following the install process up until when I need to build the project from the source repo using npm and gulp - both of which I've had zero experience with. Whenever I run sudo npm install in the project directory, the process runs without complaints. However, when I run npm ls to verify that dependencies have been downloaded, I get a bunch of dependencies listed out as being missing.
How do I get npm to resolve all of these dependencies?
System Details
OS Ubuntu 14.04 (Trusty)
Node JS v0.12.9
NPM v3.5.1
What I've tried
Removing node_modules folder and re-running sudo npm install as referenced in this SO answer for a similar question: npm Gulp dependencies missing, even after running npm install
Uninstalling and reinstalling node and npm
#Strainy, as your research :D
It was a combination of running as sudo and not having the build-essentials.
That's why you should not use sudo npm
Follow these steps:
try npm uninstall. and then try npm install.
Also If it still doesn't work.
Try:
npm install -g npm-install-missing
or
npm-install-missing
For further reading, click here.

Resources