Skip to content

/usr/bin/env: ‘node\r’: No such file or directory ... #58

Closed

Description

@wvillegasm

Two things:

  1. If you are working on Linux/OS X you will have the following issue:
    /usr/bin/env: ‘node\r’: No such file or directory ...
    This is bc file is saved with line separator CRLF instead LF, just save the index.js using LF line separator will solve the issue

  2. index.js on version 3.0.0 is the same as the previous version, it does not has any change, still cwd: process.cwd, instead cwd: process.cwd(). Developer made the change on test/index.coffee but never on index.js file

Activity

  1. darkguy2008 commented on Jun 15, 2017

    @darkguy2008
    Owner
    1. I think you need to change your git CRLF settings to Auto, depending on your OS. I am using OSX and I didn't run into that issue. Any pointers on how to reproduce it? I'm using SourceTree to do the Git work.

    2. It is because it's not being used anywhere as far as I know. index.coffee calls it, but the tests don't do anything whether if I change it to cwd or cwd() so I didn't touch it. Do you have any screenshot to prove the issue so I can see?

    Thanks!

  2. wvillegasm commented on Jun 15, 2017

    @wvillegasm
    Author

    In order to reproduce the issue you could:

    1. npm i -D parallelshell

    2. Write your script into the package.json, for instance:
      "scripts": {
      "build": "webpack -w",
      "serve": "browser-sync start --server --startPath \"./built/static/\" --serveStatic \"./built/static/\" --index \"index.html\" --files \"./built/static/**/*.+(html|css|js)\" --port 3001",
      "watch:dev": "parallelshell "npm run build" "npm run serve""
      }

    3. Run your script:
      npm run watch:dev

    Here is the result:

    [email protected] watch:dev /home/xxx/data/project/reactjs/mydev
    parallelshell "npm run build" "npm run serve"

    /usr/bin/env: ‘node\r’: No such file or directory
    npm ERR! file sh
    npm ERR! code ELIFECYCLE
    npm ERR! errno ENOENT
    npm ERR! syscall spawn
    npm ERR! [email protected] watch:dev: parallelshell "npm run build" "npm run serve"
    npm ERR! spawn ENOENT
    npm ERR!
    npm ERR! Failed at the [email protected] watch:dev script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:

  3. wvillegasm commented on Jun 15, 2017

    @wvillegasm
    Author

    npm publish from Windows handles CRLF incorrectly

    npm/npm#2097

  4. darkguy2008 commented on Jun 15, 2017

    @darkguy2008
    Owner

    Alright, I'm trying that, but I'm getting errors with that package.json format - actually, using double quotes inside a double-quoted string isn't valid JSON, I'm using this package.json and it throws an error, first of all:

    package.json:

    {
      "name": "test1",
      "version": "1.0.0",
      "description": "Test1",
      "main": "index.js",
      "scripts": {
        "build": "echo 'build'",
        "serve": "echo 'serve'",
        "watch:dev": "parallelshell "npm run build" "npm run serve""
      },
      "author": "",
      "license": "ISC"
    }
    

    error:

    npm ERR! file /Users/darkguy/_git/test1/package.json
    npm ERR! code EJSONPARSE
    npm ERR! Failed to parse json
    npm ERR! Unexpected token 'p' at 9:35
    npm ERR!     "watch:dev": "parallelshell "npm run build" "npm run serve""
    npm ERR!                                   ^
    npm ERR! File: /Users/darkguy/_git/test1/package.json
    npm ERR! Failed to parse package.json data.
    npm ERR! package.json must be actual JSON, not just JavaScript.
    npm ERR! 
    npm ERR! Tell the package author to fix their package.json file. JSON.parse
    npm ERR! A complete log of this run can be found in:
    

    Would you please be so kind to provide OS version, NPM and Node version so I can replicate? in OSX it's not working, I'm on Sierra 10.12.5, Node is 8.1.1 and NPM is 5.0.3.

    Also, the publish was made under this same OSX machine, so that bug doesn't apply to me :P

  5. wvillegasm commented on Jun 15, 2017

    @wvillegasm
    Author

    You need to escape the double quotes:

    "watch:dev": "parallelshell \"npm run build\" \"npm run serve\""

    Running on:
    Linux 4.10.0-20-generic #22-Ubuntu
    node -v ~ v8.0.0
    npm -v ~ 5.0.3

  6. darkguy2008 commented on Jun 15, 2017

    @darkguy2008
    Owner

    Alright, you were right! I managed to reproduce it, I'll fix it right away, thanks for reporting :D

  7. wvillegasm commented on Jun 15, 2017

    @wvillegasm
    Author

    You are very welcome

  8. added a commit that references this issue on Jun 15, 2017
  9. darkguy2008 commented on Jun 15, 2017

    @darkguy2008
    Owner

    Fixed & published! 👍

  10. wvillegasm commented on Jun 15, 2017

    @wvillegasm
    Author

    Thank You !
    It is working like a charm
    👯‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions