Error installing firebase-tools for cloud functions

I’ve used firebase-tools to create & manage cloud functions. I haven’t used it in a while, but I just ran firebase deploy, and I’m getting a bunch of these warnings…

WARN tar EISDIR: illegal operation on a directory, open '/usr/local/lib/node_modules/…

I tried reinstalling it by running

npm install -g firebase-tools

but the warnings show up again, followed by the error…

npm ERR! enoent ENOENT: no such file or directory, chmod ‘/usr/local/lib/node_modules/firebase-tools/node_modules/mkdirp/bin/cmd.js’

Any ideas? I’m at a standstill here.

Thanks.

Any time I see global paths like /usr/local/lib, my first instinct is to recommend nvm. It makes isolating problems like this much easier, as entire node/npm ecosystems are independent and easily blown away/recreated without affecting anything else.