Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error after updating to 6.1.0 #3866

Closed
njzjz opened this issue Apr 7, 2019 · 24 comments
Closed

Error after updating to 6.1.0 #3866

njzjz opened this issue Apr 7, 2019 · 24 comments
Labels
type: bug a defect, confirmed by a maintainer

Comments

@njzjz
Copy link

njzjz commented Apr 7, 2019

$ yarn test
yarn run v1.3.2
(node:6135) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
warning package.json: License should be a valid SPDX license expression
$ NODE_ICU_DATA='node_modules/full-icu' nyc mocha test/test
: No such file or directory

full log: https://travis-ci.com/njzjz/chemicaltools-js/jobs/190964352

But it worked fine before.

Sent from PPHub For GitHub

@njzjz
Copy link
Author

njzjz commented Apr 7, 2019

Before updating it worked well.
https://travis-ci.com/njzjz/chemicaltools-js/jobs/190893338

@jasonk
Copy link

jasonk commented Apr 7, 2019

I just ran into this too. If you just run mocha without anything wrapping it the problem becomes clearer:

$ mocha
env: node\r: No such file or directory

It seems the package was published with CRLF line endings, which will cause issues on non-windows platforms:

$ file *.js bin/* lib/*.js
browser-entry.js:       ASCII text, with CRLF line terminators
index.js:               ASCII text, with CRLF line terminators
mocha.js:               UTF-8 Unicode text, with very long lines, with CRLF, LF line terminators
bin/_mocha:             a /usr/bin/env node script text executable, ASCII text, with CRLF line terminators
bin/mocha:              a /usr/bin/env node script text executable, ASCII text, with CRLF line terminators
bin/options.js:         ASCII text, with CRLF line terminators
lib/context.js:         ASCII text, with CRLF line terminators
lib/errors.js:          ASCII text, with CRLF line terminators
lib/growl.js:           ASCII text, with CRLF line terminators
lib/hook.js:            ASCII text, with CRLF line terminators
lib/mocha.js:           ASCII text, with CRLF line terminators
lib/pending.js:         ASCII text, with CRLF line terminators
lib/runnable.js:        ASCII text, with CRLF line terminators
lib/runner.js:          UTF-8 Unicode text, with CRLF line terminators
lib/stats-collector.js: ASCII text, with CRLF line terminators
lib/suite.js:           ASCII text, with CRLF line terminators
lib/test.js:            ASCII text, with CRLF line terminators
lib/utils.js:           ASCII text, with CRLF line terminators

@AviVahl
Copy link
Contributor

AviVahl commented Apr 7, 2019

yeah, shebang in /bin/mocha got broken because of the \r.
This renders mocha cli useless on many Unix-based systems (I use Fedora).
@juergba

@juergba
Copy link
Contributor

juergba commented Apr 7, 2019

yes, I have seen it. I'm working on it. Any suggestions?

@kevinoid
Copy link
Contributor

kevinoid commented Apr 7, 2019

I agree with @jasonk and @AviVahl that the \r on the shebang line is causing breakage. I just wanted to note that the shebang is automatically fixed during installation by npm v5.4.0 and later (due to npm/npm@0ef320cb4 from npm/npm#16634). So the breakage is conditional on the version of npm used to install mocha.

@AviVahl
Copy link
Contributor

AviVahl commented Apr 7, 2019

@juergba thx for the quick response.
check this out: https://help.github.com/en/articles/dealing-with-line-endings
you might want to add a .gitattributes file to the repo and rerelease with LF line endings.

@AviVahl
Copy link
Contributor

AviVahl commented Apr 7, 2019

@kevinoid I personally use latest [email protected] and it breaks there...

@kevinoid
Copy link
Contributor

kevinoid commented Apr 7, 2019

@AviVahl Does yarn change the shebang line itself? If not, that would explain why yarn is also affected.

@cspotcode
Copy link
Contributor

cspotcode commented Apr 7, 2019

Came here to suggest the gitattributes approach as well. It'll force LF checkouts on all platforms; I add one religiously to all new projects.

* text=auto EOL=LF

EDIT: also add an editorconfig forcing LF line endings if you haven't already.

@AviVahl
Copy link
Contributor

AviVahl commented Apr 7, 2019

@kevinoid I guess they leave the file untouched. AFAIK, on Linux, yarn basically creates symlink from .bin to the file specified in the "bin" field of the package's package.json. If that file was published with CRLF, it breaks. This is unlike the Windows behavior, where a proxy .cmd file is auto-created by yarn/npm.

@juergba
Copy link
Contributor

juergba commented Apr 7, 2019

@cspotcode can we chat please on gitter?

sverweij added a commit to sverweij/dependency-cruiser that referenced this issue Apr 7, 2019
build breaks on node 6 due to mochajs/mocha#3866

using 6.0.2 until that is fixed, or node 6 is de-supported whichever comes first
@jasonk
Copy link

jasonk commented Apr 7, 2019

Since mocha is already using prettier, the easy fix would be to change the prettier config in package.json to enforce specific line endings instead of just keeping whatever is there, and to ensure that prettier gets run before publishing...

// in package.json:
...
"scripts": {
  "prepublishOnly": "nps format test clean build",
},
"prettier": {
  "endOfLine": "nl"
}

borisovg added a commit to borisovg/node-websocket that referenced this issue Apr 7, 2019
mochajs/mocha#3866 broke tests on Node v6
@borisovg
Copy link

borisovg commented Apr 7, 2019

FYI this makes Travis tests fail when using Node 6.

@AlexZeitler
Copy link

CircleCI is broken as well using Node 10.

@juergba
Copy link
Contributor

juergba commented Apr 7, 2019

@AlexZeitler on Unix as well?

@AlexZeitler
Copy link

@juergba Not on my local machine (Ubuntu 18.04) but in CircleCI:
https://circleci.com/gh/PDMLab/httpproblem/15

@mceachen
Copy link

mceachen commented Apr 7, 2019

@juergba thanks for addressing this.

I'm surprised that the smoke test in CI didn't catch this issue.

If you want help setting up CI on other platforms (mac on travis and windows on appveyor), I'd be happy to help you do that (the PR is not that much work, it's mostly creating the appveyor account, which has to be done by a committer).

@juergba
Copy link
Contributor

juergba commented Apr 7, 2019

@mceachen
Thanks, we have windows tests on appveyor. It seems pushing to github was fine, just npm publish went wrong.

@cspotcode
Copy link
Contributor

cspotcode commented Apr 7, 2019 via email

mceachen added a commit to photostructure/exiftool-vendored.js that referenced this issue Apr 7, 2019
@AlexZeitler
Copy link

@juergba Upgrading to 6.1.1 fixed it 👍

@juergba
Copy link
Contributor

juergba commented Apr 7, 2019

@AlexZeitler thank you for your confirmation!

@mceachen
Copy link

mceachen commented Apr 7, 2019

@mceachen
Thanks, we have windows tests on appveyor.

Ah, that's great. I didn't see a badge for the build in the header of the README.

@boneskull
Copy link
Contributor

The problem was the npm publish command run on Windows produced a tarball
that could not run on Linux. I don't think the smoke test deals with that.

@juergba How did you fix this?

@boneskull boneskull added the type: bug a defect, confirmed by a maintainer label Apr 8, 2019
@boneskull
Copy link
Contributor

n/m, .gitattributes change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

10 participants