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

/usr/bin/env: ‘node\r’: No such file or directory error Command failed with exit code 127. #8106

Closed
amjedomar opened this issue May 7, 2020 · 2 comments

Comments

@amjedomar
Copy link

amjedomar commented May 7, 2020

Bug description

I created a npm package called atco then I used it in project called atco-simple-example

This is atco-simple-example's package.json

{
  "name": "atco-simple-example",
  "scripts": {
    "heroku-postbuild": "atco"
  },
  "devDependencies": {
    "atco": "^1.0.11",
    "typescript": "^3.8.3"
  },
  "private": true
}

Now when I run yarn heroku-postbuild in my local machine (windows platform) it works successfully without any errors.

However when I deployed atco-simple-example,

Heroku returned this error when executed yarn heroku-postbuild

/usr/bin/env: ‘node\r’: No such file or directory
error Command failed with exit code 127.

Here is the full log

-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  12.16.3
       engines.npm (package.json):   unspecified (use default)
       engines.yarn (package.json):  1.22.4
       
       Resolving node version 12.16.3...
       Downloading and installing node 12.16.3...
       Using default npm version: 6.14.4
       Resolving yarn version 1.22.4...
       Downloading and installing yarn (1.22.4)...
       Installed yarn 1.22.4
       
-----> Installing dependencies
       Installing node modules (yarn.lock)
       yarn install v1.22.4
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       info [email protected]: The platform "linux" is incompatible with this module.
       info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
       [3/4] Linking dependencies...
       [4/4] Building fresh packages...
       Done in 3.53s.
       
-----> Build
       Running heroku-postbuild (yarn)
       yarn run v1.22.4
       $ atco
/usr/bin/env: ‘node\r’: No such file or directory
error Command failed with exit code 127.
       info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-----> Build failed
       
       We're sorry this build is failing! You can troubleshoot common issues here:
       https://devcenter.heroku.com/articles/troubleshooting-node-deploys
       
       If you're stuck, please submit a ticket so we can help:
       https://help.heroku.com/
       
       Love,
       Heroku
       
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

However the above error doesn't happen when I told Heroku to use npm rather then yarn

-----> Node.js app detected
       
-----> Creating runtime environment
       
       NPM_CONFIG_LOGLEVEL=error
       NODE_ENV=production
       NODE_MODULES_CACHE=true
       NODE_VERBOSE=false
       
-----> Installing binaries
       engines.node (package.json):  12.16.3
       engines.npm (package.json):   6.14.5
       
       Resolving node version 12.16.3...
       Downloading and installing node 12.16.3...
       Bootstrapping npm 6.14.5 (replacing 6.14.4)...
       npm 6.14.5 installed
       
-----> Installing dependencies
       Installing node modules (package.json + package-lock)
       added 90 packages from 144 contributors and audited 179 packages in 4.715s
       
       3 packages are looking for funding
         run `npm fund` for details
       
       found 0 vulnerabilities
       
       
-----> Build
       Running heroku-postbuild
       
       > [email protected] heroku-postbuild /tmp/build_9b98840a15e22a87b9cd7e3c1a002ab1
       > atco
       
       Running...
       
       Done Successfully
       
-----> Caching build
       - node_modules
       
-----> Pruning devDependencies
       removed 40 packages and audited 126 packages in 1.118s
       found 0 vulnerabilities
       
       
-----> Build succeeded!
-----> Discovering process types
       Procfile declares types -> web
-----> Compressing...
       Done: 22.6M
-----> Launching...
       Released v3
       https://atco-simple-example.herokuapp.com/ deployed to Heroku

What is the current behavior?

Throw the following error rather then execute bin file ./src/index.js (in atco package)

/usr/bin/env: ‘node\r’: No such file or directory
error Command failed with exit code 127.

What is the expected behavior?

Execute bin file ./src/index.js (in atco package)

Steps to Reproduce

Deploy atco-simple-example to Heroku (instructions in repository's README)

Environment

  • Node Version: 12.16.3
  • Yarn v1 Version: 1.22.4
  • OS and version: Heroku
@ObserverOfTime
Copy link

Convert src/index.js to use Unix line endings (LF) either via your editor or the dos2unix command.

@amjedomar
Copy link
Author

Convert src/index.js to use Unix line endings (LF) either via your editor or the dos2unix command.

Yes, your solution solved the problem

Thank you very much @ObserverOfTime

RobinBlomberg added a commit to RobinBlomberg/kysely-codegen that referenced this issue Aug 29, 2022
- May possibly fix "No such file or directory error" (yarnpkg/yarn#8106)
RobinBlomberg added a commit to RobinBlomberg/kysely-codegen that referenced this issue Aug 29, 2022
- May possibly fix "No such file or directory error" (yarnpkg/yarn#8106)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants