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! firstname.lastname@example.org start: `node entry.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the email@example.com 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.
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