srod/node-minify

Command line error using 6.2.0

davidyell opened this issue · 4 comments

Environment

  • Mac OS
  • Node 15.10.0
  • "@node-minify/cli": "^6.2.0",

What I did

  • yarn install -D @node-minify/cli
  • yarn run node-minify

What happened

$ yarn run node-minify
yarn run v1.22.4
$ /Users/davidyell/Sites/Envoy/node_modules/.bin/node-minify
env: node\r: No such file or directory
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Things I've tried

  • which node returns /usr/local/bin/node

I think this is just because the executable file has a windows line ending?

#!/usr/bin/env node\r\n

When I edit to to
#!/usr/bin/env node\n

It works okay

srod commented

Sorry for the delay, do you still have the issue?
I tried on my side; I can't reproduce.
Also tried to use dos2unix to convert cli.js, but nothing changed like it was already in Unix format.

@srod Ahok, perhaps I opened the file in an editor which saved it with a different file ending maybe. Thanks for checking! I'll close this one as resolved 👍

I also encountered this issue. Though the code on GitHub seems fine:

$ curl -sS https://raw.githubusercontent.com/srod/node-minify/6.2.0/packages/cli/bin/cli.js | head -1 | hexdump -c
0000000   #   !   /   u   s   r   /   b   i   n   /   e   n   v       n
0000010   o   d   e  \n
0000014

when I install from yarn or download from CDN, the fetched code break lines with \r\n. To reproduce:

$ curl -sS https://cdn.jsdelivr.net/npm/@node-minify/cli@6.2.0/bin/cli.js | head -1 | hexdump -c
0000000   #   !   /   u   s   r   /   b   i   n   /   e   n   v       n
0000010   o   d   e  \r  \n
0000015

This problem only occurs for version 6, and only in bin/cli.js. No idea how this happened.