Sanity check: using a later version of NPM with Meteor

I recently updated my system from Ubuntu 21.10 to 22.04 and my meteor project was getting errors about loading a crypto shared library.

I deleted node_modules and ran meteor npm i but npm hangs, unless, I found, I remove googleapis from package.json.

I updated my project from Meteor 2.62.7.2

I’ve spent some time trying to figure this out but am not getting very far. Running npm install with my globally installed version of npm (8.5.5, instead of meteor’s version, 6.14.16) works perfectly fine.

Is using a later version of NPM sane, so long as it’s consistently used (and not mixed w/ meteor’s NPM)?

Thank you.

1 Like

Hi @drone1, you should use node 14 and the npm version that comes with it. Meteor does not support yet node 16. Maybe that’s why you are facing this issue

OK, thanks.

I’m facing the issue because I updated Ubuntu from 21.10 to 22.04 LTS. That was the only thing that changed.

After updating running the server started showing errors about a dynamic library not being able to load (crypto-related), then the next time I ran meteor npm install it started hanging, unless I deleted the googleapis package. npm install works fine, meteor npm install does not.

I saw some npm threads about it on github and it’s an issue that was never resolved, which is why I wanted to see if I might be able to use a later version since it may be an npm bug. :frowning:

I saw some people had tried re-installing npm, which in my case presumably would mean re-installing meteor – I can try that next.

Thank you.

last I checked you could use latest npm with Meteor, just need to update meteor’s copy with
meteor npm i -g npm

I have run into version issues with googleapis before, so there might be something there. Unfortunately, as you found, their docs and GH issues are pretty useless

1 Like

Oh interesting. @hschmaiske is this the case? Thanks.

@coagmano wouldnt this just update the global npm, not meteor’s npm?

each Meteor version packages a node and npm with it. Using meteor node or meteor npm uses that pacakged version. The global install is then also scoped to only that version of node and npm for that version of Meteor

1 Like

each Meteor version packages a node and npm with it. Using meteor node or meteor npm uses that pacakged version.

Yep, this I’m well aware of. :slight_smile:

The global install is then also scoped to only that version of node and npm for that version of Meteor

So are you suggesting that meteor npm i -g npm would install that same version that Meteor is running, but globally?

The issue is that this version of npm causes things to hang w/ googleapis in package.json/npm-shrinkwrap.json – how would it help to install the bogus version globally?

Also I use nvm so it would probably be a mess if I were to let meteor adjust the global install.

I’d try installing 6.14.16 (Meteor’s NPM version) with nvm, but nvm won’t allow me to install 6.14.16 as it appears not to be an option.

➜ nvm ls-remote | grep 6.14
        v0.6.14
        v6.14.0   (LTS: Boron)
        v6.14.1   (LTS: Boron)
        v6.14.2   (LTS: Boron)
        v6.14.3   (LTS: Boron)
        v6.14.4   (LTS: Boron)
       v16.14.0   (LTS: Gallium)
       v16.14.1   (LTS: Gallium)
       v16.14.2   (LTS: Gallium)

Odd, no?

Thanks a lot!

Alright so I fixed it. Turns out it was not the googleapis package causing the issue. It’s because I have forked repos and my package.json points there. I saw that ls-remote was being called multiple times for a github URL for one of my forked repos, and that lead me to the workaround.

The workaround here fixed it for me: [BUG] npm install hangs for several minutes due to git ls-remote git:// url scheme · Issue #1673 · npm/cli · GitHub

[url "git@github.com:"]   # Fixes meteor npm hanging! See https://github.com/npm/cli/issues/1673
  insteadOf = git://github.com/

I just needed to add those 2 lines to ~/.gitconfig and that stopped the hanging. What those 2 lines are actually doing is not something I understand. Also: lol, what is that guys…

The following command now works every time without hanging: rm -rf node_modules && meteor npm cache clean --force && meteor npm i --ddd

Jeez!

No, the exact reverse. It would update the version of npm that is used with that specific version of Meteor. For example given these made up meteor versions:

Meteor delta - node 12 - npm 6
Meteor gamma - node 14 - npm 6
Meteor kappa - node 16 - npm 8

If you are in a project using Meteor gamma, and run meteor npm i -g npm, then only the npm bundled with Meteor gamma will update giving you:

Meteor delta - node 12 - npm 6
Meteor gamma - node 14 - npm 8
Meteor kappa - node 16 - npm 8

It does not affect the npm install outside the Meteor scope


nvm is for installing node, not npm