NPM Issues – Where to Start Troubleshooting NPM Issues

node.jsnpm

Hopefully this is the right forum to post. Coming stack overflow but I think this is more you guys' expertise.

I have a centos 6.10 box. It had Node.js and npm running ok. I don't know which versions of them were they. I tried to update them to the LTS by running

sudo npm install n -g

Now, whenever I run npm I get this error:

node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.16' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by node)

I tried to uninstall node and npm completely and reinstalling them, no luck there neither. Now I'm out of tricks. Can anybody help me with what should I do now please?

Best Answer

Your CentOS is just too old.

You can check which package the library belongs to by running yum provides /usr/lib64/libstdc++.so.6. In my case (on CentOS 7, but that doesn't matter for this) this is libstdc++-4.8.5-39.el7.x86_64.

If you look up the package for libstdc++ for CentOS 6 on pkgs.com you'll see against which glibc headers it was compiled. In this case you see that the latest version was:

  • libstdc++.so.6(GLIBCXX_3.4.13)(64bit)

Your output shows that the newer npm version needs at least GLIBCXX_3.4.14.

I guess you can compile node.js yourself against the library versions you have available, but I'd rather update CentOS to a newer release. It will be end of life anyway in November 2020.

Related Topic