revelrylabs / elixir-nodejs

An Elixir API for calling Node.js functions
MIT License
192 stars 30 forks source link

Using elixir-nodejs #78

Open nitishymtpl opened 1 year ago

nitishymtpl commented 1 year ago

Hi, I am having difficulty configuring elixir-nodeJS.

Here is what, I did in Application.ex.

%{ id: NodeJS, start: {NodeJS, :start_link, [[path: "/workspace/lib/keila/JS", pool_size: 4]]} }

In demos.ex

defmodule Keila.Demos do import NodeJS def add_and_print do result = NodeJS.call("echo", ["hello"]) #=> {:ok, "hello"} IO.puts "The sum is #{result}" end end

But the error is coming as:

iex(1)> c("demos.ex")

== Compilation error in file demos.ex == ** (CompileError) demos.ex:2: module NodeJS is not loaded and could not be found

** (CompileError) compile error (iex 1.14.4) lib/iex/helpers.ex:204: IEx.Helpers.c/2 iex:1: (file)

ndrean commented 9 months ago

yeah, good question. this repo is abandoned.

francktchowa commented 3 weeks ago

You should add NodeJS.Supervisor in your application.ex file in place of NodeJS