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

Comments

@njzjz
Copy link

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

This comment has been minimized.

Copy link
Author

commented Apr 7, 2019

@jasonk

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

commented Apr 7, 2019

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

@kevinoid

This comment has been minimized.

Copy link

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@0ef320c from npm/npm#16634). So the breakage is conditional on the version of npm used to install mocha.

@AviVahl

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Apr 7, 2019

@kevinoid I personally use latest yarn@1.15.2 and it breaks there...

@kevinoid

This comment has been minimized.

Copy link

commented Apr 7, 2019

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

@cspotcode

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Apr 7, 2019

FYI this makes Travis tests fail when using Node 6.

@AlexZeitler

This comment has been minimized.

Copy link

commented Apr 7, 2019

CircleCI is broken as well using Node 10.

@juergba

This comment has been minimized.

Copy link
Member

commented Apr 7, 2019

@AlexZeitler on Unix as well?

@AlexZeitler

This comment has been minimized.

Copy link

commented Apr 7, 2019

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

@mceachen

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link
Contributor

commented Apr 7, 2019

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

This comment has been minimized.

Copy link

commented Apr 7, 2019

@juergba Upgrading to 6.1.1 fixed it 👍

@juergba

This comment has been minimized.

Copy link
Member

commented Apr 7, 2019

@AlexZeitler thank you for your confirmation!

@mceachen

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link
Member

commented Apr 8, 2019

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

This comment has been minimized.

Copy link
Member

commented Apr 8, 2019

n/m, .gitattributes change.

@boneskull boneskull closed this Apr 8, 2019
@msimerson msimerson referenced this issue Apr 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.