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

[api-extractor] /usr/bin/env: 'node\r': No such file or directory when starting version 7.38.1 with npx #4413

Closed
haakonflatval-cognite opened this issue Nov 1, 2023 · 3 comments · Fixed by #4414
Labels
priority The maintainers consider it to be an important issue. We should try to fix it soon.

Comments

@haakonflatval-cognite
Copy link

Summary

Running any command with api-extractor through npx, e.g. npx api-extractor run crashes with the error

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

I am only seeing this error on version 7.38.1 of Api-Extractor, not 7.38.0. It is also only occuring on Linux, the command works fine in Windows.

Repro steps

  • On Linux, create a minimal repository with api-extractor setup, the package having version 7.38.1

  • Run e.g. npx api-extractor run

    Expected result:

  • Api-Extractor runs with the associated settings

    Actual result:

  • Api-Extractor crashes with the above error message.

Details

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/api-extractor version? 7.38.1
Operating system? Linux
API Extractor scenario? reporting
Would you consider contributing a PR? Probably not
TypeScript compiler version? 5.2.2
Node.js version (node -v)? 18.17.0
@dmichon-msft
Copy link
Contributor

This sounds like the bin stub was emitted with CRLF line endings for some reason.

@octogonz
Copy link
Collaborator

octogonz commented Nov 1, 2023

@dmichon-msft @iclanton it sounds related to this Zulip issue report:

Rob Lisiecki wrote:

The latest build of rush has a significant bug for systems that are sensitive to line endings. It is no longer compatible with Linux systems (5.110.0) released October 30 2023. The core files (possibly index.js or other) contain carriage return characters which are incompatible with Linux systems. I would like to open a bug report for this issue but it was suggested that I post here first. Most likely a file was modified by a windows system and the return character was added.

To repro, just install rush on a Linux (perhaps Debian for example) and run Rush install, You will get the following error:

yarn global add @microsoft/[email protected]

echo rush update
rush update

rush update
/usr/bin/env: ‘node\r’: No such file or directory
Failed to run 'override-build': Exit code was 127.

The error ‘node\r’: No such file or directory means that the system is attempting to run a command with /r appended, which is being added to the command, the command node, should run, but not ‘node\r’. This likely will only impact systems that do not expect the /r character.

Is this a known issue in the most recent release? I wouldn't mind opening an issue or locating the specific line of code and issuing a PR if this issue is not currently tracked.

Also with the release process, is there a tag or PR for the 5.110.0 I can use to review changes to find the specific file and location of the line ending addition that is causing the issue? This has blocked our pipeline build process for production with a time sensitive deployment. For the time being I have pinned to a previous known working version (5.87.0)

@octogonz octogonz added the priority The maintainers consider it to be an important issue. We should try to fix it soon. label Nov 1, 2023
@octogonz
Copy link
Collaborator

Proposal for PNPM to catch this problem in the future: pnpm/pnpm#7311

@iclanton iclanton moved this to Needs triage in Bug Triage Nov 15, 2023
@iclanton iclanton moved this from Needs triage to Closed in Bug Triage Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority The maintainers consider it to be an important issue. We should try to fix it soon.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants