Post/Code

HomeAboutUsesNow

NPM, CLI and Package Versions

After my build and formatting failures yesterday, I started working with a sense of positivity despite the setbacks. As it turned out, my new day would continue to be plagued with npm issues.

At one point during the day there was a power failure, this also happened right as I was busy installing some dependencies. My hunch is that this interruption to installation somehow took things off the rails. I had been in the process of installing the npm package firebase-admin via the Firebase CLI. Not only would this installation not complete due to issues with node-gyp and xcode tools, it variously gave me repeating EACCESS errors despite being (re)connected to the internet (the power was back on by this stage).

Ultimately, after several attempts and some Googling I realised that since I have not used the Firebase CLI in quite some time, it was in need of an update. There was also, seemingly some conflict of rights in the sense that I needed to use sudo in order to get the installation of the updated firebase-admin to install correctly so that node-gyp could do what it needed. I once again needed to remove and re-install my node_modules in the process.

In any event, my takeaways from the past few days are this:

  • If you have not used a particular CLI or project (i.e. packages in a while) make sure to check your versions in package.json as well as your various CLI versions. Make a note of these because version changes in the intervening can really mess you up.
  • If there are later versions, take a look at what they mean for you, if possible, update and keep updating. This can be a pain, but at least you are then taking a pro-active approach towards it and actively educating yourself about the possible changes and impacts to be aware of.
  • Make sure to use nvm and my gut is to also gravitate towards npx. Admittedly, I have not used npx much, but the further you move away from global CLI and packages, the likely better of you are!