mdgriffith / elm-optimize-level-2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

PedroHLC opened this issue · comments

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.

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

@mdgriffith any intention to republish it?

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"
  },

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.

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!

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