Why does NVM install think I am using the wrong version of Node? - node.js

While trying to install the less node module globally via the Node Package Manager, I ran into an interesting problem that I am having trouble solving. Basically, I am getting an error that claims the node module, less, is incompatible with my version of node. It says I am using node v0.6.12 and that it requires at least v0.8.0 to work.
First I made sure that I was using one of the latest versions of Node:
nvm use v0.10.11
Now using node v0.10.11
node -v
v0.10.11
Then I tried to install the less module globally:
sudo npm install -g less
And got this error message:
npm ERR! error installing less#1.4.0
npm ERR! error rolling back less#1.4.0 Error: UNKNOWN, unknown error '/usr/local/lib/node_modules/less'
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: request#2.21.0
npm ERR! Required: ["node >= 0.8.0"]
npm ERR! Actual: {"npm":"1.1.4","node":"0.6.12"}
npm ERR!
npm ERR! System Linux 3.2.0-45-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "less"
npm ERR! cwd /home/derek
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm not ok
Here you can see that the node package manager is trying to install less using (or thinks it is using) node v0.6.12. It seems as though some others have run into this problem, but his problem turned out to be that he had previously installed node via apt-get, and was resolved by him using the Node Version Manager. I initially installed Node via NVM, however.the Any help that you guys could offer would be greatly appreciated.
Note: It is worth mentioning that it will successfully install using npm install -g less, without sudo permissions. However, as soon as another terminal is opened, the less node module is removed from /usr/local/lib/node_modules, rendering it useless.

Have you tired completely removing the old version, v0.6.12 with something like
sudo apt-get purge node.
I'm not a great with linux, but it seems sudo still has the old version of node in its path and calling npm under sudo is finding it and trying to use it.

The Node.js installed with Linux is probably installed in /usr/sbin/ (at least it was for me on Ubuntu 13.04). That's the old version. Since you have nvm installed and having that manage your Node.js versions, you'll want to point to ~/.nvm/v0.10.11/bin/node.

You already got a nodejs copy on your system.
The solution is to re-install or overwrite your node using /usr/local for your prefix
git clone https://github.com/joyent/node
cd node
./configure --prefix=/usr/local
make
sudo make install
Here is a similar problem:
how to delete node on linux mint 13?

Related

my npm commands aren't working, npm is bugging?

C:\Users\jason\OneDrive\Documents\Web-Dev-Projects\pinterest-clone>npm install
npm ERR! Windows_NT 10.0.19042
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jason\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v14.17.6
npm ERR! npm v3.10.10
npm ERR! cb.apply is not a function
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\jason\OneDrive\Documents\Web-Dev-Projects\pinterest-clone\npm-debug.log
I am getting this really annoying error that doesn't even tell me what's wrong with npm. I tried deleting and installing node.js again and running the command npm install but I would still get the error. I even tried running a command to use the latest version of npm and it still wouldn't work (npm install -g npm-windows-upgrade & npm-windows-upgrade).
It seems like npm is just being very buggy and doesn't want to work. Help please.
Based on this very similar issue, you really shouldn't be using npm 3.x with Node 14.
You might want to uninstall Node, ensure there are no traces of Node or npm on your system, then reinstall Node 14 or 16.
They automatically install newer versions of npm (6 or newer).
Also, the npm-windows-upgrade package you mention hasn't been updated in 3 years. Maybe don't use it?
You are definitely not running the latest version of the tools. NPM is in v7 and Node.js is in v16. Uninstall what you have currently installed, and download the latest version (make sure to choose Current not LTS) to install the latest version. Here is the link
I'd switch to a package manager specifically for managing different versions of Node + NPM side-by-side on your machine, which saves you the hassle of having to have 1 global installation that just "has to work" for all your projects.
Linux has nvm (node version manager). Since you're on Windows, you might want to check out the Windows-"fork": https://github.com/coreybutler/nvm-windows.
It should prevent incompatible versions of node and npm being installed together.

npm WARN: npm does not support Node.js v12.4.0

I've been getting the following warnings lately whenever I run any npm script:
npm WARN npm npm does not support Node.js v12.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
It says that I should upgrade to a newer version, but v12.4 is the newest version. Even though the scripts run fine, I think there's no guarantee and something might break at any moment.
I've also tried updating npm in case there's a newer version using npm install npm -g but got the error:
npm ERR! path /usr/local/Cellar/node/12.4.0/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'] {
npm ERR! stack: 'Error: EACCES: permission denied, access ' +
npm ERR! "'/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
Then I've seen that Homebrew version of npm can't be updated using npm itself, so I tried updating through Homebrew using brew upgrade npm but got this error:
Error: npm 12.4.0 already installed
For some reason Brew mixes up nodes and npms versions.
What am I doing wrong and how can I get rid of this warning?
What worked for me:
if you try running this command "npm cache clean -f" and it doesn't work,
on your windows machine(mine is windows 10)
access the "npm" and "npm-cache" folders in this location "~\AppData\Roaming\"
delete these two folders "npm" and "npm-cache".
go to your windows search bar and search for Node, right click to open file location, run the uninstaller to uninstall NodeJs.
then visit nodejs.org and download and install node again, if you've already downloaded it, visit the folder where you downloaded it to reinstall it.
after installation, check your version of npm by typing "npm -v" on your command terminal to see the new updated version of npm installed on your machine.
now you're all set, Happy coding.
Seems like you messed up with permissions in /usr/local.
Here is how to fix that:
Fix /usr/local permissions:
sudo chown -R `id -un`:`id -gn` /usr/local
Clean npm cache and uninstall it:
npm cache clean -f
npm -g uninstall npm
Reinstall node (with npm)
brew reinstall node
Upgrade npm:
npm -g i npm
That should bring npm#6.9.2.
You should avoid using sudo while installing software with brew or npm, that could cause issues like this.
If you have nvm you may have an issue in which your node version installed at a certain version didn't match.
For example, I accidentally used: npm i -g node --force resulting in my nvm v12.21.0 to point to v16.5.0 (the latest version of node at that time directly downloadable).
To solve: I ran:
Just for good measure brew uninstall nvm
brew install nvm.
nvm uninstall 12.21
nvm install 12.21
Just for good measure I ran npm i -g npm resulting in the latest version of npm installed on that virtual node.
After installing within some repo (using npm i) you may also want to check your: ~/.npmrc.
email=myemail#company.com
registry=https://artifactory.company.com/npm/npm/
always-auth=true
user-agent=npm/6.14.11 node/v12.21.0 darwin x64
_authToken=siofjwoirgiowrgnioaenrvoianeoiio32noi23nio23nio23nio
It should look something like this: (or you might not have any of that.
Had the same issue with Debian 10 (buster) when I tried installing the npm and node.js. They were incompatible and wouldn't update. This was what I found works for me.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
The nodejs package was installed at a different path and I manually deleted the old package (in /usr/bin/) and added a symlink to point to the new one (in /usr/local/bin).
sudo rm /usr/bin/node
sudo ln -s /usr/local/node /usr/bin/node
This is the initial printouts from running the commands. The npm version updates from 5.8.0 to 8.1.2. But the nodejs version stayed at 10.24.0 even after reboot with hash -r.
None of the answers here worked. I had to delete the npm and npm-cache folders, then reinstall npm. Details here: npm does not support Node.js v12.18.3
After step 4 posted by Styx, and if node claims installation fo a newer version but npm -v keeps showing outdated version
Code for Mac and node installed with brew:
cd /usr/local/bin/
mv npm npm-backup
mv npx npx-backup
ln -s /usr/local/Cellar/node/14.2.0/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
ln -s /usr/local/Cellar/node/14.2.0/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
npm -version
6.14.5
I hit this issue and the steps above didn't work for me. I think it can happen if you try to upgrade Node or NPM without updating the other also. At least I think that's what happened to me.
I was trying to create a new Angular project and I had a very old version on my machine. I got an error to upgrade Node, so I bumped it to the latest version. After that I got the error running any npm command.
I resolved it simply by going to:
https://nodejs.org/en/download/
Getting the latest version and installing that in a pkg file (mac). After install was complete I was able to run everything. I'm guessing it worked because the versions of each mismatched, so one wouldn't run without the other being downgraded.
I also tried the brew option but I was getting other issues. My corporate machine sometimes blocks installations in that route, so it might work for others.
For Windows, this was driving me crazy, and all of the above solutions were not working, I would still get the old version of node showing for node -v.
For me simply killing the terminal window and starting it again resolved the issue. No amount of cache clearing worked until this. I know it sounds dumb, but that's what resolved this for me in the end. Hope this helps someone else not lose hours farting around with this.
I've have this issue in npm -v package,so you have to easy step in follow of solve this problem.
npm use stable
nvm use stable
nvm cache clear
nvm install stable --default
you can closed the terminal then check the `npm --version
Looks like a permission issue. Try with sudo

NodeJS "npm update -g npm" fails with "Error: Refusing to delete" (Installed via package, NOT homebrew)

While trying to fix a JPG compatibility issue, I'm running into the following error when trying to update npm on my Mac OSX (Yosemite). Note that I did not install via homebrew, instead via the official package. (I'm using version 0.10.37 to counteract yet another NPM package issue).
Here are the steps I take:
brew uninstall node and brew uninstall npm to be triple-sure Node is not present on my system via Homebrew. The output is as expected, Error: No such keg: /usr/local/Cellar/node
Download the package from http://nodejs.org/dist/v0.10.37/ and install it.
node -v to verify that Node is installed.
npm update -g npm
And here's the output from that last command:
$ npm update -g npm
npm ERR! Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
File exists: /usr/local/share/man/man3/npm-bin.3
Move it away, and try again.
npm ERR! System Darwin 14.1.0
npm ERR! command "node" "/usr/local/bin/npm" "update" "-g" "npm"
npm ERR! cwd /Users/topher
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/local/share/man/man3/npm-bin.3
npm ERR! code EEXIST
npm ERR! error rolling back Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm
npm ERR! error rolling back at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:57:12)
npm ERR! error rolling back at next (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:43:14)
npm ERR! error rolling back at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:52:12
npm ERR! error rolling back at Object.oncomplete (evalmachine.<anonymous>:108:15)
npm ERR! error rolling back { [Error: Refusing to delete: /usr/local/share/man/man3/npm-bin.3 not in /usr/local/lib/node_modules/npm] code: 'EEXIST', path: '/usr/local/share/man/man3/npm-bin.3' }
npm ERR! not ok code 0
When I delete the above mentioned file and try again, I get another error because the npm command no longer exists. It looks like the update partially succeeded in that the npm command was deleted:
$ npm
-bash: /usr/local/bin/npm: No such file or directory
When I search for this "Refusing to delete" error, I see tons of advice for how to fix a botched Homebrew install (plus some unnecessarily condescending instructions on how to remove the Homebrew package. But I'm not installing the package via homebrew; the advice I'm finding there doesn't seem relevant in my case.
How should I go about troubleshooting this? Anyone else know of / have this problem / can think of a quick fix?
Thanks in advance!
This isn't a complete answer, but just to follow up I found a way to work around this issue.
My ultimate need was to get node running with the package resemble installed. Resemble relies on cairo, which was installed via homebrew; it seems that this was my first mistake. Because Cairo was apparently improperly installed, a couple packages were missing; this forced me to use one workaround that triggered other errors and required other workarounds... and so forth.
When I removed the Cairo homebrew package and instead built Cairo from source (using this guide), several other errors I was having just melted away.
So the lesson I'm learning is: Don't use Homebrew for anything finnicky, or for any dependencies of anything finnicky.
I solve it by this:
rm /usr/bin/npm
/usr/lib64/node_modules/npm/bin/npm-cli.js install npm -g
npm -v # success !

Getting npm: command not found. How do I reinstall NPM when Node is already installed? Where did NPM go?

I'm starting Learn to Build Modern Web Apps with the AngularJS Tutorial and running into issues very early.
I have node installed:
/path/ang-news node -v
v0.10.26
I was using NPM earlier but was running into trouble with Yeoman. I've repeated these steps a while back but Grunt stopped working so I started fresh.
I ran:
$ sudo npm install -g generator-angular
and all the dependencies were installing until I received:
npm WARN package.json mongo#0.1.0 No repository field.
npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer generator-angular#0.9.1 wants generator-karma#>=0.8.2
I then tried updating:
$ npm update -g
I should have run this as an administrator. I received tons of error messages, this seemed most pertinent:
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "update" "-g"
npm ERR! cwd /path/ang-news
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! not ok code 0
Then I tried uninstalling generator-karma and starting fresh:
$ sudo npm uninstall -g generator-karma
but received:
sudo: npm: command not found
$ npm -v
-bash: /usr/local/bin/npm: No such file or directory
My first question is: Why did NPM suddenly disappear?
[EDIT: Kudos to #try-catch-finally to pointing out the havoc that ensues when switching between normal user and sudo when issuing commands. It turns out that I messed up my user environment and NPM was no longer installed.]
My understanding is that NPM is installed when you install Node, so my second question is: How do I reinstall just NPM? I'd prefer not to have to reinstall Node from the beginning.
[EDIT: Kudos to #hawk and #try-catch-finally - it doesn't appear that installing NPM alone is an option, but there are easy ways to reinstall both.]
If you have a working node, you can re-install npm
curl -L https://npmjs.org/install.sh | sudo sh
Unfortunately npm update -g does not do what anybody expects. Fixing this is on the npm roadmap, but it's going to take a while.
You almost never need to install a package globally, unless (like generator-angular or grunt-cli) you want to use that package as a command.
Just in case you've done this with brew, I recommend this article on github. Will save you a lot of time.
https://gist.github.com/DanHerbert/9520689
Fixing npm On Mac OS X for Homebrew Users
Run the following commands to remove all existing global npm modules, uninstall node & npm, re-install node with the right defaults, install npm as its own pacakge, and configure the location for global npm modules to be installed.
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.node >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
Node and npm should be correctly installed at this point. The final step is to add ~/.node/bin to your PATH so commands you install globally are usable. I added this line to my ~/.path script, which gets run via ~/.bash_profile. Run the following line as is.
export PATH="$HOME/.node/bin:$PATH"
I met the exactly same problem after execute command to install the npm with latest version on redhat 7.1:
npm install npm#latest -g
after some tries i found the solution:
yum reinstall npm
I hope this could help redhat/centos users.

npm install <module> persistent error ? (node-gyp build ?)

I try to install jsdom such:
$ sudo npm install -g jsdom
# OR
$ sudo npm install jsdom
After some successfull command, the install quickly fails, with the first error message being after the [....] :
$ sudo npm install jsdom
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
[....]
> contextify#0.1.7 install /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
gyp: /home/yug/.node-gyp/0.10.25/common.gypi not found (cwd: /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify) while reading includes of binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.8.0-35-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/domelementtype
npm ERR! contextify#0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify#0.1.7 install script.
npm ERR! This is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "jsdom"
npm ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/entities
....
Hint? This bug also appears for other modules :
$sudo npm install -g topojson
#bug with `contextify#0.1.7 install` error as well.
How to fix that ?
Edit: I tried sudo apt-get remove --purge nodejs npm topojson then reinstalling via various ways. Even when nodejs reinstall is successfull, the error stays, so I guess it's rather contextual (node.gyp ? cwd ? ...). Remove/reinstall ways tried :
ubuntu_setup.sh
with native outdated url
with url updated to https://github.com/joyent/node.git,
sudo add-apt-repository ppa:chris-lea/node.js,
and handmade git clone https://github.com/joyent/node.git (trial canceled)
using various other ways :
way1 : ogoing
As you're finding out from the comments, this is a very common issue. So common, in fact, that the authors of jsdom have documented it right in the README file for the project's git repository.
TL;DR
You need to have a C++ compiler and Python2.7 installed on your machine to install contextify which is a dependency of jsdom. Otherwise, the jsdom install will fail.
From the README on the Github page for jsdom:
Contextify
Contextify is a dependency of jsdom, used for running <script> tags within the page. In other words, it allows jsdom, which is run in Node.js, to run strings of JavaScript in an isolated environment that pretends to be a browser environment instead of a server. You can see how this is an important feature.
Unfortunately, doing this kind of magic requires C++. And in Node.js, using C++ from JavaScript means using "native modules." Native modules are compiled at installation time so that they work precisely for your machine; that is, you don't download a contextify binary from npm, but instead build one locally after downloading the source from npm.
Unfortunately, getting C++ compiled within npm's installation system can be tricky, especially for Windows users. Thus, one of the most common problems with jsdom is trying to use it without the proper compilation tools installed. Here's what you need to compile Contextify, and thus to install jsdom:
Windows
A recent copy of the x86 version of Node.js for Windows, not the x64 version.
A copy of Visual C++ 2010 Express.
A copy of Python 2.7, installed in the default location of C:\Python27.
There are some slight modifications to this that can work; for example full versions of Visual Studio usually work, and sometimes you can even get an x64 version of Node.js working too. But it's tricky, so start with the basics!
Mac
XCode needs to be installed
"Command line tools for XCode" need to be installed
Launch XCode once to accept the license, etc. and ensure it's properly installed
Linux
You'll need various build tools installed, like make, Python 2.7, and a compiler toolchain. How to install these will be specific to your distro, if you don't already have them.
Try installing jsdom again after satisfying the requirements mentioned above for your OS, and see if that solves it.
By the way, you are getting the same issue with topojson because it has a dependency on d3 which in turn depends on jsdom, so it is just the same problem installing jsdom. Hope this helps!
--EDIT--
Since it sounds like you're using Ubuntu, I would recommend starting with the following command:
sudo apt-get install build-essential
This will install make and g++ and some other tools. This package and Python2.7 is probably about all you'll need to successfully install contextify.
Seems I found a way by carefully deleting all node-related file and folder on my computer.
0. Context: I previously made several unsuccessful console clean-ups, with
sudo apt-get remove --purge nodejs npm topojson
followed by ~3 different ways to reinstall nodejs. I tried EACH way, from clean-up to reinstall, between 2 & 4 times.
1. Terminal purging: Let's first cleaned up my mess the deepest way possible:
npm cache clean; bower cache clean; grunt clean;
sudo apt-get remove --purge nodejs npm topojson
Yet, I just noticed that this deep purge does NOT purge/delete installed node modules, which stay persistent.
2. Hand purge: Also, I pushed the purge further with an hand purge for both nodejs and node_modules. I looked for ALL related folders on my computer, nearer the root (ubuntu: /home/<user>/) the better. I was careful to delete all previously installed global .../node-modules/ folders, without deleting local modules (specific local installations, which were still working).
3. Reinstall: Then the following consoles allowed a clean reinstall:
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm install -g topojson jsdom
Afterwhat, my file conversion via npm module topojson (depending itself on jsdom) worked fine :
cd /myfolder/
topojson -o output.topo.json input.geo.json
4. Conclusion: I can not identify why, which file/folder deletion allowed the successful sudo apt-get install nodejs + sudo npm install -g topojson reinstall. But thist deep cleanup via mouse and recursive remove sudo rm -r [node related folder/file] definitively unlocked my situation.
/!\ Be very careful with the rm -r recursive remove. /!\
Solution 1b: I [suspect][1] the rm -r /home/<user>/local/lib/node_modules/ to be the key element unlocking the situation. You may list the global (-g) node_modules, then remove the relevant one(s) (topojson and/or jsdom and/or node-gyp) specifically, then reinstall it(them).
Commands: On ubuntu, try...
cd /home/<user>/local/lib/node_modules/ #replace <user> by relevant user name to set your cwd
ls -1 # give the list of global modules names
rm -r /<module_name> #replace <module_name> by relevant name to remove it
sudo npm install -g <module_name> #replace <module_name> by relevant name for global install
Note: topojson depends on jsdom and npm-gyp.
[1]: not tried, but makes sense according to my diagnostic.

Resources