mdgriffith / elm-optimize-level-2

BSD 3-Clause "New" or "Revised" License
129 stars 14 forks source link

npmjs version of "bin/elm-optimize-level-2.js" has an invalid shebang #69

Closed PedroHLC closed 2 years ago

PedroHLC commented 3 years ago

Hi, we're using elm-optimize-level-2 successfully in at least three projects, so firstly, I would like to thank you!

Today I was bumping them from 0.1.5 to 0.2.3, and our CIs broke with:

$ paack-elm-build
/usr/bin/env: ‘node\r’: No such file or directory
/usr/bin/env: use -[v]S to pass options in shebang lines

Simply editing node_modules/elm-optimize-level-2/bin/elm-optimize-level-2.js with vim seems to fix it.

But your file on master seems to be just fine and correct. The problem is specific to the one deployed in npmjs.

ahankinson commented 2 years ago

I also encountered this problem running elm-optimize-level-2 with yarn. Editing the executable and creating new line endings fixed it.

PedroHLC commented 2 years ago

@mdgriffith any intention to republish it?

MarcoDaniels commented 2 years ago

The issue seems to be due to the line ending of the file CRLF instead of LF. A quick fix until it gets updated would be to use the package crlf and use it in a post install:

  "scripts": {
    "postinstall": "crlf --set=LF node_modules/elm-optimize-level-2/bin/elm-optimize-level-2.js"
  },
cmditch commented 2 years ago

Are you publishing from Windows or Mac @mdgriffith?

Looks like if it's republished from Mac, we won't encounter this issue. If you're publishing from Windows we might have to find another solution.

Edit: We could enforce LF line endings w/ .gitattributes. See here.

mdgriffith commented 2 years ago

Ah, I probably published from my Windows comp last time because that's where I was benchmarking from.

I'll publish from my mac this time!

mdgriffith commented 2 years ago

Ok, new version published! This should be resolved. Ping me here if it isn't!