ModClean / modclean

Remove unwanted files and directories from your node_modules folder
MIT License
400 stars 15 forks source link

Doesn't work as global #2

Closed davidchase closed 9 years ago

davidchase commented 9 years ago

After doing npm install -g modclean and running modclean it throws

env: node\r: No such file or directory

KyleRoss commented 9 years ago

Which OS are you using? Do you have other globally installed modules that work? It sounds like the npm directory is not in your path environment variable.

davidchase commented 9 years ago

OS X 10.10.3 and i have a lot of other globally installed modules that work, also npm directory is in my path...

KyleRoss commented 9 years ago

I'm not currently near an OS X machine to test on at the moment but there is no reason it shouldn't work. Did you receive any errors while installing the module?

davidchase commented 9 years ago

Nope no errors, installed just fine.. asked a friend of mine to try and install the cli same issue

KyleRoss commented 9 years ago

Until I can get to an OS X machine, the best I can provide at the moment is: http://stackoverflow.com/questions/14803978/npm-global-path-prefix

It seems like this is an issue with npm. There is nothing special this module does for installing globally, npm handles all of that and the stack overflow article shows some resolutions to it. I will respond back within the next day or so of my findings. Thanks!

davidchase commented 9 years ago

Thanks for looking into it no worries

yyx990803 commented 9 years ago

Same issue here, however I doubt it has anything to do with the Stackoverflow answer. It seems this is because on Windows machines the newline is \r\n while on Unix systems it's only \n.

In your bin/modclean.js the first line #!/usr/bin/env node is interpreted by Unix systems as #!/usr/bin/env node\r, thus resulting in the error.

The solution is to remove the \r in your bin file.

KyleRoss commented 9 years ago

You're completely right. I thought I had it set to use Unix new lines but I guess it wasn't. I will fix that and get the module updated soon. Thanks for your investigation!

KyleRoss commented 9 years ago

After some trial and error, I fixed this issue and released it as version 1.1.2 to npm. I've tested it on OS X Yosemite and it's working as expected when installed globally. Feel free to reopen if there are any other issues related to this.

davidchase commented 9 years ago

:+1: