npm / OSX returns error when used in scripts
peacechen opened this issue · 6 comments
When used in an npm script as a local dependency, bestzip 1.1.1 returns an error:
"scripts": {
"zip": "bestzip myArchive.zip myDir/ myFile.xml",
},
env: node\r: No such file or directory
As a work-around, calling the local version works:
"scripts": {
"zip": "node ./node_modules/bestzip/bin/cli.js myArchive.zip myDir/ myFile.xml",
},
This error happens under NodeJS v0.12.5 / OSX 10.10.3 but not NodeJS v0.10.38 / Win7.
I suspect that this issue is caused by a local install. A global install may not have this problem. To recreate this may require uninstalling the global one.
I also noticed that the documentation is out of date. The destination output file is the first argument, not the final argument.
Hey, sorry about that. I'll try to take a look over the weekend. If you want to send a PR for the documentation, I'll get that merged in right away.
Thanks for looking into this. I created a PR for the Readme.
Thanks!
Hey, so I was able to reproduce this on my mac, and I'm not quite sure what's different, but I think it's either an encoding thing or a non-printable character thing. Either way, I have a test release that seems to work. Could you try it out and report back?
npm install bestzip-@1.1.1-test1
Hey, after a little more research, it sounds like the bug was from the file having windows-style line endings (CRLF) while the OS X terminal assumes unix-style ones (LF), so it was searching for a program named node\r
instead of node
.
I have my windows git install set to the defaults of "checkout as CRLF, commit as LF" and I apparently published the last version from windows. I wonder if this is something npm should handle....
So, I put out a v1.1.2 release with that and your readme updates:
npm install --save bestzip@1.1.2
Please try that one out and let me know if it resolves the issue for you.
Confirmed that it's fixed in 1.1.2. Thanks for the quick turn-around!