Error: libnode.so.64: cannot open shared object file: No such file or directory

I encountered this error recently when attempting run an executable NodeJS file. This error was due to a mismatch of the currently installed npm packages against my NodeJS version.

What Caused The Error?

I installed my NPM packages and thereafter upgraded my NodeJS version to 14.x. As my NPM packages had stuff like node-gyp which compiles against my current OS and NodeJS, it causes a mismatched and threw this error.

Fix

Simply run the following command in your NodeJS application folder.

npm clean-install

Docker

If you are running Docker, check if your npm packages are installed and compiled from within the Docker container. Sometimes, it might be due to it being installed and compiled on the host system and then thereafter being mounted instead of the former. Hence, this results in a mismatch as well.

Docker Fix

Run the above command while being inside the Docker container to ensure that everything is installed and compiled against your Docker’s NodeJS version instead of your host node’s NodeJS version.

Author: Woo Huiren

Currently a student at National University of Singapore. I contribute to opensource projects - primarily PHP and Angular related. I write about PCF and PWS related stuff too.

Leave a Reply