wende / elchemy

Write Elixir code using statically-typed Elm-like syntax (compatible with Elm tooling)

Home Page:https://wende.github.io/elchemy/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot get running

itsgreggreg opened this issue · comments

Mac OS 10.13.2, elm 0.18, elixir 1.6.2

Working from the README I cannot get elchemy to work.

Steps to reproduce:

> mix new test
> cd test
> elchemy init
> mix compile
==> elchemy
Compiling 6 files (.ex)

== Compilation error in file elm/Elchemy/Native/NativeDict.ex ==
** (CompileError) elm/Elchemy/Native/NativeDict.ex:2: module Elchemy.XBasics is not loaded and could not be found
    expanding macro: Elchemy.import_std/0
    elm/Elchemy/Native/NativeDict.ex:2: Native.Dict (module)
    expanding macro: Elchemy.__using__/1
    elm/Elchemy/Native/NativeDict.ex:2: Native.Dict (module)

seems that file isn't there:

> tree elm-deps/wende/elchemy-core/0.6.4
elm-deps/wende/elchemy-core/0.6.4
├── config
│   └── config.exs
├── elm
│   └── Elchemy
│       └── Native
│           ├── NativeDict.ex
│           └── NativeRegex.ex
├── lib
│   ├── elchemy.ex
│   ├── glue.ex
│   ├── spec.ex
│   └── test.ex
├── mix.exs
└── test
    ├── elchemy_test.exs
    ├── glue_test.exs
    ├── spec_test.exs
    └── test_helper.exs

6 directories, 12 files

I have run elchemy clean and elchemy init and tried to I manually add the missing files but it still doesn't compile with the same error.

Can you post a tree of your project and contents of your mix.exs file?

Also if there was an error during compilation it probably should be somewhere in the output after
elchemy clean && mix compile. If you could post the output that will be helpful too

The entirety of my process:

$> mix new test
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating config
* creating config/config.exs
* creating lib
* creating lib/test.ex
* creating test
* creating test/test_helper.exs
* creating test/test_test.exs

Your Mix project was created successfully.
You can use "mix" to compile it, test it, and more:

    cd test
    mix test

Run "mix help" for more commands.
$>  cd test
$>  elchemy init
Found existing entry: /Users/jenkins/.asdf/installs/elixir/1.6.1/.mix/archives/elchemy-0.6.4
Are you sure you want to replace it with "https://github.com/wende/elchemy/releases/download/0.6.4/elchemy-0.6.4.ez"? [Yn] y
* creating /Users/jenkins/.asdf/installs/elixir/1.6.1/.mix/archives/elchemy-0.6.4
Elchemy 0.6.4 initialised. Make sure to add:

	|> Code.eval_file("elchemy.exs").init

to your mix.exs file as the last line of the project() function.
This pipes the project keyword list to the elchemy init function to configure some additional values.

Then run mix test to check if everything went fine
$>  vim mix.exs
$>  mix test
warning: redefining module ElchemyInit (current version defined in memory)
  elchemy.exs:1

-- Downloading Elchemy deps --
Resolving packages...
  ▶ Getting updates for: elm-lang/core
  ▶ Getting updates for: wende/elchemy-core
Solving dependencies...
  ● elm-lang/core - https://github.com/elm-lang/core (5.1.1)
  ● wende/elchemy-core - https://github.com/wende/elchemy-core (0.6.4)
Packages configured successfully!
-- Copying Elixir native files --
-- Compiling Elm files --
----------
Type Checking elm/Hello.elm
events.js:136
      throw er; // Unhandled 'error' event
      ^

Error: spawn /Users/jenkins/.dotfiles/dotfiles/.config/yarn/global/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
    at _errnoException (util.js:999:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at process._tickCallback (internal/process/next_tick.js:152:19)
    at Function.Module.runMain (module.js:703:11)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3
Type Check failed
** (Mix) Compilation error
$>  mix test
warning: redefining module ElchemyInit (current version defined in memory)
  elchemy.exs:1

==> elchemy
Compiling 6 files (.ex)

== Compilation error in file elm/Elchemy/Native/NativeDict.ex ==
** (CompileError) elm/Elchemy/Native/NativeDict.ex:2: module Elchemy.XBasics is not loaded and could not be found
    expanding macro: Elchemy.import_std/0
    elm/Elchemy/Native/NativeDict.ex:2: Native.Dict (module)
    expanding macro: Elchemy.__using__/1
    elm/Elchemy/Native/NativeDict.ex:2: Native.Dict (module)
could not compile dependency :elchemy, "mix compile" failed. You can recompile this dependency with "mix deps.compile elchemy", update it with "mix deps.update elchemy" or clean it with "mix deps.clean elchemy"

mix.exs :

defmodule Test.MixProject do
  use Mix.Project

  def project do
    [
      app: :test,
      version: "0.1.0",
      elixir: "~> 1.6",
      start_permanent: Mix.env() == :prod,
      deps: deps()
    ]
    |> Code.eval_file("elchemy.exs").init
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      # {:dep_from_hexpm, "~> 0.3.0"},
      # {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"},
    ]
  end
end

tree of project :

.
├── README.md
├── _build
│   └── test
│       └── lib
│           ├── elchemy
│           │   └── ebin
│           └── test
│               └── ebin
├── config
│   └── config.exs
├── elchemy.exs
├── elm
│   └── Hello.elm
├── elm-deps
│   └── wende
│       └── elchemy-core
│           └── 0.6.4
│               ├── config
│               │   └── config.exs
│               ├── elm
│               │   └── Elchemy
│               │       └── Native
│               │           ├── NativeDict.ex
│               │           └── NativeRegex.ex
│               ├── lib
│               │   ├── elchemy.ex
│               │   ├── glue.ex
│               │   ├── spec.ex
│               │   └── test.ex
│               ├── mix.exs
│               └── test
│                   ├── elchemy_test.exs
│                   ├── glue_test.exs
│                   ├── spec_test.exs
│                   └── test_helper.exs
├── elm-package.json
├── elm-stuff
│   ├── exact-dependencies.json
│   └── packages
│       ├── elm-lang
│       │   └── core
│       │       └── 5.1.1
│       │           ├── CONTRIBUTING.md
│       │           ├── LICENSE
│       │           ├── README.md
│       │           ├── changelog.md
│       │           ├── elm-package.json
│       │           ├── src
│       │           │   ├── Array.elm
│       │           │   ├── Basics.elm
│       │           │   ├── Bitwise.elm
│       │           │   ├── Char.elm
│       │           │   ├── Color.elm
│       │           │   ├── Date.elm
│       │           │   ├── Debug.elm
│       │           │   ├── Dict.elm
│       │           │   ├── Json
│       │           │   │   ├── Decode.elm
│       │           │   │   └── Encode.elm
│       │           │   ├── List.elm
│       │           │   ├── Maybe.elm
│       │           │   ├── Native
│       │           │   │   ├── Array.js
│       │           │   │   ├── Basics.js
│       │           │   │   ├── Bitwise.js
│       │           │   │   ├── Char.js
│       │           │   │   ├── Date.js
│       │           │   │   ├── Debug.js
│       │           │   │   ├── Json.js
│       │           │   │   ├── List.js
│       │           │   │   ├── Platform.js
│       │           │   │   ├── Regex.js
│       │           │   │   ├── Scheduler.js
│       │           │   │   ├── String.js
│       │           │   │   ├── Time.js
│       │           │   │   └── Utils.js
│       │           │   ├── Platform
│       │           │   │   ├── Cmd.elm
│       │           │   │   └── Sub.elm
│       │           │   ├── Platform.elm
│       │           │   ├── Process.elm
│       │           │   ├── Random.elm
│       │           │   ├── Regex.elm
│       │           │   ├── Result.elm
│       │           │   ├── Set.elm
│       │           │   ├── String.elm
│       │           │   ├── Task.elm
│       │           │   ├── Time.elm
│       │           │   └── Tuple.elm
│       │           └── tests
│       │               ├── Main.elm
│       │               ├── Test
│       │               │   ├── Array.elm
│       │               │   ├── Basics.elm
│       │               │   ├── Bitwise.elm
│       │               │   ├── Char.elm
│       │               │   ├── CodeGen.elm
│       │               │   ├── Dict.elm
│       │               │   ├── Equality.elm
│       │               │   ├── Json.elm
│       │               │   ├── List.elm
│       │               │   ├── Maybe.elm
│       │               │   ├── Regex.elm
│       │               │   ├── Result.elm
│       │               │   ├── Set.elm
│       │               │   └── String.elm
│       │               ├── elm-package.json
│       │               └── run-tests.sh
│       └── wende
│           └── elchemy-core
│               └── 0.6.4
│                   ├── DOCS.md
│                   ├── README.md
│                   ├── config
│                   │   └── config.exs
│                   ├── elm
│                   │   ├── Elchemy
│                   │   │   ├── Lazy.elm
│                   │   │   ├── Native
│                   │   │   │   ├── NativeDict.ex
│                   │   │   │   └── NativeRegex.ex
│                   │   │   ├── XBasics.elm
│                   │   │   ├── XBitwise.elm
│                   │   │   ├── XChar.elm
│                   │   │   ├── XDebug.elm
│                   │   │   ├── XDict.elm
│                   │   │   ├── XList.elm
│                   │   │   ├── XMaybe.elm
│                   │   │   ├── XRegex.elm
│                   │   │   ├── XResult.elm
│                   │   │   ├── XSet.elm
│                   │   │   ├── XString.elm
│                   │   │   └── XTuple.elm
│                   │   └── Elchemy.elm
│                   ├── elm-package.json
│                   ├── lib
│                   │   ├── elchemy.ex
│                   │   ├── glue.ex
│                   │   ├── spec.ex
│                   │   └── test.ex
│                   ├── mix.exs
│                   └── test
│                       ├── elchemy_test.exs
│                       ├── glue_test.exs
│                       ├── spec_test.exs
│                       └── test_helper.exs
├── lib
│   └── test.ex
├── mix.exs
└── test
    ├── elchemy_test.exs
    ├── test_helper.exs
    └── test_test.exs

41 directories, 112 files

So that's the origin of the issue:

Error: spawn /Users/jenkins/.dotfiles/dotfiles/.config/yarn/global/node_modules/elm/Elm-Platform/0.18.0/.cabal-sandbox/bin/elm-make ENOENT
    at _errnoException (util.js:999:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at process._tickCallback (internal/process/next_tick.js:152:19)
    at Function.Module.runMain (module.js:703:11)
    at startup (bootstrap_node.js:194:16)
    at bootstrap_node.js:618:3

Can you confirm that you're able to build regular Elm projects using your installed elm-make?

lol good catch. I've been using elm-* local to projects for so long I had no idea my global install was broke. Thanks!

Glad I could help 🎉