2
votes

I was trying to install node trough brew and it was giving a lot of errors, and apparently some file was not giving the permission, so I thunked that the file was from other failed try to intall node and I decide to remove the directory. It failed to remove the dir and the files, but apparently some had been erased.

They are: module.js:340 throw err; ^ Error: Cannot find module 'child-process-close' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at /usr/local/lib/node_modules/npm/lib/npm.js:15:1 at Object. (/usr/local/lib/node_modules/npm/lib/npm.js:461:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)

How can I solve this? I just wanted to try sails.js for fun, but I didn't see any fun time yet, only problems.

Thank you

3

3 Answers

2
votes

It appears that your issue is not with the sails global or project installation, but rather that you corrupted the nodejs installation. I'd recommend you to just download nodjs again from nodejs.org (this downloads a .pkg) and install it with that package.

If this complains about permissions and overwriting things (which I don't think), try first deleting the whole node_modules folder with sudo:

sudo rm -fr /usr/local/lib/node_modules
2
votes

I know this is super late. However, I was getting this same error while trying get a react native app up and running.

I installed node with HomeBrew and after getting the following:

Error: Cannot find module 'child-process-close'
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 /usr/local/lib/node_modules/npm/lib/npm.js:15:1
at Object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:520:3)
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)

I then ran brew postinstall node and got:

Permission denied - /usr/local/lib/node_modules/npm/AUTHORS

So then I ran:

sudo brew postinstall node

and it seemed to work fine. I could go about installing waterline, firebase, or whatever else I tried.

Hope this helps!

1
votes

Run npm install from your project directory to re-install all modules listed in your package.json.