standard / semistandard

:icecream: All the goodness of `standard/standard` with semicolons sprinkled on top.
MIT License
1.41k stars 123 forks source link

Semistandard broken on OS X starting in 14.2.1 #266

Closed apodolny closed 4 years ago

apodolny commented 4 years ago

What version of this package are you using? 14.2.2, but I've test 14.2.1 and 14.2.0. 14.2.0 is fine, but after that it's broken

What operating system, Node.js, and npm version? MacOS 10.15.5 Node 12.16.2 (also fails on MacOS 10.13 and Node.js 10) as detailed in Travis CI build here: https://travis-ci.org/github/lovell/sharp/jobs/705021697

What happened? Running semistandard fails immediately with the error: env: node\r: No such file or directory error Command failed with exit code 127.

What did you expect to happen? Semistandard to run.

Are you willing to submit a pull request to fix this bug? Don't have any experience with the codebase at the moment.

clsource commented 4 years ago

This is due to the file cmd.js https://github.com/standard/semistandard/blob/master/bin/cmd.js

It has a windows end of line CRLF. To fix this just need to overwrite the file line endings.

Its probably a yarn issue https://github.com/yarnpkg/yarn/issues/5480

because node automatically converts newlines

https://github.com/npm/npm/issues/12371

https://stackoverflow.com/questions/30344858/node-script-executable-not-working-on-mac-env-node-r-no-such-file-or-directo

hutson commented 4 years ago

I also encountered this recently when the CI tests for an automated lockfile update failed - https://github.com/hyper-expanse/semantic-delivery-gitlab/pull/42

The issue, as noted by @apodolny, began occurring with version 14.2.1:

info Direct dependencies
└─ semistandard@14.2.1
info All dependencies
├─ ansi-escapes@4.3.1
├─ cli-cursor@3.1.0
├─ cli-width@3.0.0
├─ eslint-config-standard@14.1.1
├─ eslint@6.8.0
├─ espree@6.2.1
├─ figures@3.2.0
├─ globals@12.4.0
├─ inquirer@7.3.3
├─ mimic-fn@2.1.0
├─ mute-stream@0.0.8
├─ onetime@5.1.0
├─ optionator@0.8.3
├─ restore-cursor@3.1.0
├─ run-async@2.4.1
├─ rxjs@6.6.0
└─ semistandard@14.2.1
Done in 4.83s.
$ cat -v node_modules/.bin/semistandard
#!/usr/bin/env node^M
^M
var opts = require('../options.js')^M
require('standard-engine').cli(opts)^M

The previous version, 14.2.0 does not contain the Windows line endings:

info Direct dependencies
└─ semistandard@14.2.0
info All dependencies
├─ ansi-escapes@3.2.0
├─ cli-cursor@2.1.0
├─ cli-width@2.2.1
├─ eslint-config-standard@14.1.0
├─ eslint@6.4.0
├─ espree@6.2.1
├─ figures@2.0.0
├─ inquirer@6.5.2
├─ mimic-fn@1.2.0
├─ mute-stream@0.0.7
├─ onetime@2.0.1
├─ optionator@0.8.3
├─ restore-cursor@2.0.0
├─ run-async@2.4.1
├─ rxjs@6.6.0
└─ semistandard@14.2.0
Done in 3.87s.
$ cat -v node_modules/.bin/semistandard
#!/usr/bin/env node

var opts = require('../options.js')
require('standard-engine').cli(opts)

@Flet would you be willing to publish a version 14.2.3 using npm?

Flet commented 4 years ago

ok will do

Flet commented 4 years ago

published semistandard@14.2.3 sorry for the trouble!