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

JS error on every elm binary execution #787

Closed
AntouanK opened this Issue Dec 19, 2016 · 10 comments

Comments

Projects
None yet
5 participants
@AntouanK

AntouanK commented Dec 19, 2016

Hi.
I don't know where this bug fits, so let me know if I have to move it.

Yesterday, I got elm installed ( npm i -g elm ) in a new linux machine.
Unfortunately I get this error on every elm binary execution.
( also tried installing with yarn, same error )

/ # elm -v
events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn /root/.config/yarn/global/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm ENOENT
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

I also tried installing within docker containers.
Same error every time.

Any idea what it is?
Seems to be coming from some bin wrapper in js.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Dec 19, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Dec 19, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@halfzebra

This comment has been minimized.

Show comment
Hide comment
@halfzebra

halfzebra Dec 19, 2016

Contributor

@AntouanK you have to use sudo when installing anything with -g flag.

Contributor

halfzebra commented Dec 19, 2016

@AntouanK you have to use sudo when installing anything with -g flag.

@AntouanK

This comment has been minimized.

Show comment
Hide comment
@AntouanK

AntouanK Dec 19, 2016

@halfzebra I have changed the owner in my /local library. And in the docker container I'm root anyway.
So I think that's not the issue. I would see permission errors anyway if that was the problem.

AntouanK commented Dec 19, 2016

@halfzebra I have changed the owner in my /local library. And in the docker container I'm root anyway.
So I think that's not the issue. I would see permission errors anyway if that was the problem.

@halfzebra

This comment has been minimized.

Show comment
Hide comment
@halfzebra

halfzebra Dec 19, 2016

Contributor

@AntouanK it is a known problem which does not throw a permission error for some reason.

ENOENT means there's no elm binary on your machine, and somehow the npm package fails to download elm binaries.

The way I was able to fix it is by running

sudo npm uninstall elm -g
sudo npm i elm -g

I'm reffering to issues #10, #26 and #29 in Create elm App repository.

Contributor

halfzebra commented Dec 19, 2016

@AntouanK it is a known problem which does not throw a permission error for some reason.

ENOENT means there's no elm binary on your machine, and somehow the npm package fails to download elm binaries.

The way I was able to fix it is by running

sudo npm uninstall elm -g
sudo npm i elm -g

I'm reffering to issues #10, #26 and #29 in Create elm App repository.

@AntouanK

This comment has been minimized.

Show comment
Hide comment
@AntouanK

AntouanK Dec 20, 2016

So, on my main linux machine, I got yarn installed via apt-get and that solved the problem.
yarn global add elm and it works fine.

Inside the docker container, it is still failing.
I tried a couple of images ( like mhart/alpine-node and node:alpine ) but they both fail with the same error.
sudo makes no sense there since you are already root.

Can anyone try this Dockerfile and let me know what you get?

FROM        node:alpine

RUN         npm -v
RUN         npm i -g elm

RUN         which elm
RUN         ls -lah $(which elm)

RUN         elm -v

AntouanK commented Dec 20, 2016

So, on my main linux machine, I got yarn installed via apt-get and that solved the problem.
yarn global add elm and it works fine.

Inside the docker container, it is still failing.
I tried a couple of images ( like mhart/alpine-node and node:alpine ) but they both fail with the same error.
sudo makes no sense there since you are already root.

Can anyone try this Dockerfile and let me know what you get?

FROM        node:alpine

RUN         npm -v
RUN         npm i -g elm

RUN         which elm
RUN         ls -lah $(which elm)

RUN         elm -v

@AntouanK AntouanK closed this Dec 21, 2016

@mradke

This comment has been minimized.

Show comment
Hide comment
@mradke

mradke Feb 9, 2017

@AntouanK I have the exact same issue with Docker and alpine linux

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/lib/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm ENOENT
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Have you resolved the issue before you closed it?
If so: how?

Could it be an issue that musl is being used instead of glibc in alpine linux?

mradke commented Feb 9, 2017

@AntouanK I have the exact same issue with Docker and alpine linux

events.js:160
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/lib/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm ENOENT
    at exports._errnoException (util.js:1022:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:359:16)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Have you resolved the issue before you closed it?
If so: how?

Could it be an issue that musl is being used instead of glibc in alpine linux?

@AntouanK

This comment has been minimized.

Show comment
Hide comment
@AntouanK

AntouanK Feb 17, 2017

@mradke No, I still have the same problem.
I cannot understand why elm makes you install it via npm. Why not release the linux binaries?

I think the problem is the musl library alpine uses.
So elm binaries are looking for a different libraries.
Because when you run the binary, it says not found. Which makes no sense.

I tried to build Elm from source on an alpine image, but I get segmentation fault, so I just gave up and went back to debian. :(

AntouanK commented Feb 17, 2017

@mradke No, I still have the same problem.
I cannot understand why elm makes you install it via npm. Why not release the linux binaries?

I think the problem is the musl library alpine uses.
So elm binaries are looking for a different libraries.
Because when you run the binary, it says not found. Which makes no sense.

I tried to build Elm from source on an alpine image, but I get segmentation fault, so I just gave up and went back to debian. :(

@mradke

This comment has been minimized.

Show comment
Hide comment
@mradke

mradke Feb 20, 2017

Why not release the linux binaries

As far as I understand this is exactly what you get when installing via npm. A prebuilt version of the elm tools.
I think the way to go would be to compile it on an alpine system which might be a bit scary due to the fact that you can barely install the Haskell platform on it :-)

Thank you for coming back on this issue though - maybe I will take a closer look when I have some free time to fiddle around.

mradke commented Feb 20, 2017

Why not release the linux binaries

As far as I understand this is exactly what you get when installing via npm. A prebuilt version of the elm tools.
I think the way to go would be to compile it on an alpine system which might be a bit scary due to the fact that you can barely install the Haskell platform on it :-)

Thank you for coming back on this issue though - maybe I will take a closer look when I have some free time to fiddle around.

@AntouanK

This comment has been minimized.

Show comment
Hide comment
@AntouanK

AntouanK Feb 20, 2017

@mradke If you do which elm and follow the symlinks, you'll see that you basically are running js files with node, which in turn spawns the actually binary. I don't know why that's necessary.

For alpine, I did find an image that has haskell pre-installed
https://hub.docker.com/r/mitchty/alpine-ghc/

But like I said, building the project throws the seg fault, so I stopped there.

AntouanK commented Feb 20, 2017

@mradke If you do which elm and follow the symlinks, you'll see that you basically are running js files with node, which in turn spawns the actually binary. I don't know why that's necessary.

For alpine, I did find an image that has haskell pre-installed
https://hub.docker.com/r/mitchty/alpine-ghc/

But like I said, building the project throws the seg fault, so I stopped there.

@stoivo

This comment has been minimized.

Show comment
Hide comment
@stoivo

stoivo May 10, 2017

You could try to add it to your PATH

PATH=./node_modules/.bin/:$PATH elm 

stoivo commented May 10, 2017

You could try to add it to your PATH

PATH=./node_modules/.bin/:$PATH elm 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment