npm ERR! code ELIFECYCLE or Error: Could not locate the bindings file

When we try to start the node server using npm start, we sometimes get the following error:

Error: Could not locate the bindings file. Tried:
...
...
...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! backend@1.0.0 start: `node entry.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the backend@1.0.0 start script.
npm ERR! This is probably not a problem with npm.

Why this error happens?

In our case we cloned on repo from git and wanted to start the node server after installing the dependencies using npm install. The app we cloned had the node_modules and it had some missing dependencies. When we installed the dependencies it was intalling from the cache. So some of the dependencies were always missing.

Solution

We had to remove the npm cache and then delete the node_modules. Once those two steps are done we installed the dependencies and things worked!. Following are those setps:

Step 1: npm cache clean --force

Step 2: rm -rf node_modules

Step 3: npm install

Leave a Reply