Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remedy "Error: Cannot find module 'child-process-close'"?

I was going about business as usual and about to checkout generator-angular-fullstack.

I got no red errors but a message at the end saying Error: Cannot find module 'child-process-close'. I tried many a-thing–uninstalling node, reinstalling, manually getting rid of files and directories in local and/or global paths and tried to make sure Homebrew was the one who installed everything and somehow I've made things worse.

(Also, I initially saw errors regarding karma. Everything looked right but it doesn't seem I did any good by throwing commands at it.)

I am at a loss. All the stackoverflow questions have been clicked and I'm afraid I've probably tried too many of the suggestions. I cannot install any Yeoman generator. I cannot install anything with npm. When inside the project directory when I run npm install it throws the error. I really have no clue. Is there a way I can basically start over all together? A simple uninstall and install isn't cutting it. Something in the system needs to change but I don't know what. Any ideas?

EDIT


I don't have a thorough list of how I ended up getting Node back in working order, but this Homebrew issue was really informative & helpful. I don't know how my permissions got out of whack, it was likely my own fault. This didn't fix everything though, I was still getting child-process-close errors. Looking through issues on NPM's github, I found this, which tells how to manually remove package.tgz. The short is run rm /Users/tylersloan/.npm/connect/2.8.8/package.tgz. Viola!

like image 641
Tyler Sloan Avatar asked May 31 '14 03:05

Tyler Sloan


2 Answers

You’ll want to remove the node_modules folder using this command:

$ rm -rf /usr/local/lib/node_modules

Then re-install node:

$ brew uninstall node
$ brew install node

That brings npm back to life.

like image 187
Believe2014 Avatar answered Oct 11 '22 14:10

Believe2014


On my machine, I had to make a couple of adjustments to @Believe2014 's response

$ rm -rf /usr/local/lib/node_modules

And then reinstall node as sudo

$ brew uninstall node
$ sudo brew install node

Then npm behaved as expected for me, for example to install the Sails framework:

sudo npm install -g sails
like image 34
fusion27 Avatar answered Oct 11 '22 13:10

fusion27