question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to compile without a TTY (example: docker build)

See original GitHub issue

This is a

  • Bug Report
  • Feature Request
  • Other

Hi guys,

First I want to thank you for your amazing work on Nexe!

Unfortunately, I have a bug when using it without a TTY.

In my case, I use it in a dockerfile. When I run docker build, nexe doesn’t have a TTY attached on.

If I use the option “-i”, like in nexe -i app.js, the binary file seems to not having any code of my app.js file.

I think this is because of this code: https://github.com/nexe/nexe/blob/master/src/options.ts#L195-L210

Here is a dockerfile example:

FROM alpine:3.7

RUN apk --no-cache add nodejs nodejs-npm util-linux

RUN npm i -g nexe

RUN echo "console.log('ok');" > test.js

# First example
RUN cat test.js | nexe -t alpine-x64-8.9.4 -o test1
RUN ./test1 | grep ok

# Second example with script that simulate a TTY
RUN script --return -c 'nexe -t alpine-x64-8.9.4 -i test.js -o test2'
RUN ./test2 | grep ok

# Third example that failed
RUN nexe -t alpine-x64-8.9.4 -i test -o test3
RUN ./test3 | grep ok

Just run a docker build . to see the result

Best, Adrien

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
reitermarkuscommented, Jun 12, 2018

The bug in the issue title, “Failed to compile without a TTY” is actually not fixed. As @alecdwm mentioned, --enableStdIn='' can be used to work around this issue. Either this flag should be documented or this part

https://github.com/nexe/nexe/blob/02481f069c9462f6e0571974f603210a2578fe51/src/steps/cli.ts#L40-L43

needs to address the situation when stdin is not a TTY but is also not used, i.e. EOF.

Alternatively, use --input - to denote that stdin should be used as input file, like many UNIX tools do.

1reaction
calebboydcommented, May 11, 2018

Interesting. Thanks for the note @alecdwm!

Read more comments on GitHub >

github_iconTop Results From Across the Web

'docker build' gives error that 'docker run' doesn't. How are ...
Is the 'docker build' command actually trying to add the 'build' folder to the image from which containers are launched? Or is it...
Read more >
docker build - Docker Documentation
The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to...
Read more >
5 Steps to Compile Yocto Using Docker Containers - Witekio
How to create a Docker container for compiling Yocto ... If Docker is not included in the software repository of your distro or...
Read more >
Containerize an app with Docker tutorial - .NET - Microsoft Learn
Build a Docker image; Create and run a Docker container. You'll understand the Docker container build and deploy tasks for a .NET application....
Read more >
Troubleshooting AWS CodeBuild
ErrorCode: 500"; Error: "Cannot connect to the Docker daemon" when running a build; Error: "CodeBuild is not authorized to perform: sts:AssumeRole" when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found