Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

After Node / Npm Update, Sails.js unable to find module 'ini'

I am working on an application in Sails.js, and I ran across an authentication error when trying to create user accounts. I was not able to debug my problem, so I decided to update Node, and NPM. Now, a different error is thrown.

module.js:338
    throw err;
          ^
Error: Cannot find module 'ini'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous>       (/usr/local/lib/node_modules/sails/node_modules/rc/lib/utils.js:2:12)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

I made the mistake of not updating either node, and npm in quite some time.

I did npm install ini. npm states that the installation was successful, however when I lift sails again, the same error is thrown.

I tested another Sails project that I know works correctly, and I am getting the same error.

I completely uninstalled node and npm, and reinstalled them, with no luck. I removed the node_modules folder, and ran npm install, and got the same error. I deleted both project folders, and re-cloned them from Github, but the failure is still there.

Out of desperation, I attempted to downgrade my version of node and npm, but oddly enough, I still got the same error.

The error was only present after I updated node. It makes no sense when I downgrade Node, the error persists.

Any assistance is greatly appreciated.

like image 489
Steven Hanna Avatar asked Nov 10 '22 08:11

Steven Hanna


1 Answers

Looks like this problem traces back to the rc package, which has ini as a dependency.

You were on the right track reinstalling your node modules, as some modules with C bindings need to be recompiled to work with later versions of node.

Did you reinstall your global modules as well?

try:

npm remove -g sails
npm install -g sails

Which should recompile all of sails dependencies

like image 57
coagmano Avatar answered Nov 14 '22 23:11

coagmano