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

Remove system-specific carriage returns #564

Closed
rachelnabors opened this issue Oct 4, 2017 · 4 comments · Fixed by #565
Closed

Remove system-specific carriage returns #564

rachelnabors opened this issue Oct 4, 2017 · 4 comments · Fixed by #565

Comments

@rachelnabors
Copy link
Contributor

Looks like there's a Window's specific carriage return goofing things up on my Mac:

Rachels-MacBook-Pro-2:reloaded rachel$ sonar
env: node\r: No such file or directory

Environment

Mac, running NVM. Am unable to create .sonarrc.

  • __Node.js version: v8.6.0
  • __npm version: 5.3.0
@molant
Copy link
Member

molant commented Oct 4, 2017

Been talking with @rachelnabors, it looks like this happens with any command in the CLI.
Trying to pinpoint where the error comes from as @alrra is using a Mac and doesn't repro this with the latest version. Maybe an issue with nvm?

rachelnabors added a commit to rachelnabors/sonar that referenced this issue Oct 5, 2017
`#!/usr/bin/env node` was causing sonar to throw `env: node\r: No such file or directory` from the command line on my Mac.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ref webhintio#564
Fix webhintio#564
Close webhintio#564
molant pushed a commit to rachelnabors/sonar that referenced this issue Oct 5, 2017
`#!/usr/bin/env node` was causing sonar to throw
`env: node\r: No such file or directory` from the command line
under some configurations.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix webhintio#564
molant pushed a commit that referenced this issue Oct 5, 2017
`#!/usr/bin/env node` was causing sonar to throw
`env: node\r: No such file or directory` from the command line
under some configurations.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #564
@alrra
Copy link
Contributor

alrra commented Oct 5, 2017

Maybe an issue with nvm?

The problem is not with nvm (I'm using it, and everything is working fine).

#!/usr/bin/env node was causing sonar to throw

#!/usr/bin/env node should be there so that the system knows what to use (i.e. node, not sh, or something else) when the file is executed directly, and not as node some_file.js.

From https://docs.npmjs.com/files/package.json#bin

"Please make sure that your file(s) referenced in bin starts with #!/usr/bin/env node, otherwise the scripts are started without the node executable!"

Note: I've reverted #564, as otherwise, something similar to this will happen for users when trying to execute sonar:

/Users/alrra/.nvm/versions/node/v8.1.3/bin/sonar: line 1: use strict: command not found
/Users/alrra/.nvm/versions/node/v8.1.3/bin/sonar: line 2: syntax error near unexpected token `exports,'
/Users/alrra/.nvm/versions/node/v8.1.3/bin/sonar: line 2: `Object.defineProperty(exports, "__esModule", { value: true });'

#!/usr/bin/env node was causing sonar to throw env: node\r: No such file or directory from the command line on my Mac.

The problem is that, for some reason, on @rachelnabors' system there is a \n after node, so the system tries to execute the file using node\r instead of node, which of course doesn't exist, hence No such file or directory.

Looks like there's a Window's specific carriage return goofing things up on my Mac:

I don't see any carriage return in the code, nor the generated code from dist/

@alrra alrra reopened this Oct 5, 2017
@alrra
Copy link
Contributor

alrra commented Oct 5, 2017

@molant The problem is that when you did the release, since you did it from Windows, when the build process was executed it automatically inserted the \rs. :(

@alrra alrra closed this as completed in 8da2e2d Oct 5, 2017
@alrra
Copy link
Contributor

alrra commented Oct 5, 2017

I published a new release that should fix this issue.


@rachelnabors Can you reinstall sonar, and confirm this issue has been fixed? Thanks!

@alrra alrra reopened this Oct 5, 2017
alrra added a commit that referenced this issue Oct 5, 2017
From https://www.typescriptlang.org/docs/handbook/compiler-options.html:

 " --newLine

   Use the specified end of line sequence to be used when
   emitting files: 'crlf' (windows) or 'lf' (unix). "

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #564
molant pushed a commit that referenced this issue Oct 5, 2017
From https://www.typescriptlang.org/docs/handbook/compiler-options.html:

 " --newLine

   Use the specified end of line sequence to be used when
   emitting files: 'crlf' (windows) or 'lf' (unix). "

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #564
molant pushed a commit that referenced this issue Oct 5, 2017
From https://www.typescriptlang.org/docs/handbook/compiler-options.html:

 " --newLine

   Use the specified end of line sequence to be used when
   emitting files: 'crlf' (windows) or 'lf' (unix). "

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Fix #564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants