Giter Site home page Giter Site logo

Comments (9)

lydell avatar lydell commented on July 28, 2024

Hi! I used elm-watch with Node.js 18 for a long time, and now I use Node.js 20 and it works fine. The tests also run Node.js 18.

Can you post more details?

from elm-watch.

lucamug avatar lucamug commented on July 28, 2024

I tried several Node versions and I got this weird pattern:

OK v16.14.2
Error v18.15.0
OK v18.16.0
Error v18.17.0
Error v18.17.1
Error v20.3.1
Error v20.7.0

On a MacBook Pro - Ventura 13.5.2

from elm-watch.

lydell avatar lydell commented on July 28, 2024

Huh, that’s strange.

Could you make a reproduction repo? Then I could clone it and play around as well, with the different Node.js versions you posted.

from elm-watch.

lucamug avatar lucamug commented on July 28, 2024

Do you mean a repo with Elm code? This is an example of a project that shows that error: https://github.com/lucamug/elm-web-components (you can run both elm-watch and a web server with cmd/start).

But other repos have the same issue, for me. So I think is not related to the specific project. Also it is not excluded that is a specific problem of my configuration

from elm-watch.

lydell avatar lydell commented on July 28, 2024

A “reproduction repo” usually means a minimal repo that you make just to demonstrate an issue. It should contain step-by-step instructions on which terminal commands to run to reproduce.

from elm-watch.

lucamug avatar lucamug commented on July 28, 2024

Ok, I found the issue.

My projects install Elm inside node_folder but I assume elm-watch use the global install.

For some reason, the global install did not work. Executing elm just did not return anything.

Reinstalling Elm globally with npm -g install @lydell/elm fixed the issue.

This was hard to find! I was able to notice something strange only after I tried to run "elm init" on some of the non-working Node versions.

I wonder if having elm-watch to point to a different binary could be useful.

I expect devs that clone my projects to run "npm install" without requiring them to install Elm manually.

from elm-watch.

lydell avatar lydell commented on July 28, 2024

elm-watch tries to spawn just elm:

command: "elm",

So it’s up to you to make sure that elm is in PATH. elm-test works that way too, and elm-review (unless I’m mistaken). The idea is that:

  • If you install elm-watch globally, why wouldn’t you install elm globally as well?
  • If you install elm-watch locally, you execute it with npx. npx adds local node_modules/ folders to PATH, so both locally installed elm and globally installed elm are found.

Either way, elm-watch should never exit with “Unexpected error:” – it should print a helpful message. I tried to reproduce myself now. I made sure that elm-watch in in PATH, but not elm. This is what I get when running elm-watch hot:

-- ELM NOT FOUND -------------------------
/Users/simon/stuff/elm.json

I tried to execute elm, but it does not appear to exist!

This is what the PATH environment variable looks like:

/Users/simon/.local/share/nvm/v20.5.0/bin
/Users/simon/.ghcup/bin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/share/dotnet

Is Elm installed?

Note: If you have installed Elm locally (for example using npm or elm-tooling),
execute elm-watch using npx to make elm-watch automatically pick up that local
installation: npx elm-watch

I wonder what happens in your case? Does child_process.spawn() throw an error for some reason? I didn’t know it could. 🤔

from elm-watch.

lucamug avatar lucamug commented on July 28, 2024

It is a weird case where the elm command works but nothing happens. This is what elm-review returns:

-- UNEXPECTED ERROR ------------------------------------------------------------

I ran into an unexpected error. Please open an issue at the following link:
  https://github.com/jfmengels/node-elm-review/issues/new

Please include this error message and as much detail as you can provide. If you
can, please provide a setup that makes it easy to reproduce the error. That will
make it much easier to fix the issue.

Below is the error that was encountered.
--------------------------------------------------------------------------------
undefined

and this is what elm-test returns:

Compiling
Error attempting to run Elm compiler "/usr/local/bin/elm":
Error: spawn Unknown system error -8

from elm-watch.

lydell avatar lydell commented on July 28, 2024

Strange indeed!

  • I wonder what “Unknown system error -8” means. Tried to Google it a little but nothing has come up so far.
  • elm-test says /usr/local/bin/elm.
    • What happens if you execute that directly?
    • What does file /usr/local/bin/elm say?
    • What does shasum -a 256 /usr/local/bin/elm say?
    • Where does that binary come from / how did you install it?

from elm-watch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.