You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Read the program into memory
program, err := goja.Compile("sample_plugin", string(script), true)
if err != nil {
fmt.Println("Error compiling JavaScript program:", err)
return
}
vm := goja.New()
vm.SetFieldNameMapper(goja.TagFieldNameMapper("json", true))
registry := new(require.Registry) // this can be shared by multiple runtimes
registry.Enable(vm)
// now run the program
_, err = vm.RunProgram(program)
if err != nil {
panic(err)
}
predict, ok := goja.AssertFunction(vm.Get("predict"))
if !ok {
fmt.Println("could not get predict")
return
}`
When I try to run this, I get the following errors: GoError: Invalid module at github.com/dop251/goja_nodejs/require.(*RequireModule).require-fm (native)
Things I have tried:
Remove and Re-install both goja and goja_nodejs
Update using go mod tidy.
Can some one please help me?
The text was updated successfully, but these errors were encountered:
I have a very basic program, trying out this library before actually incorporating it into my project.
`script, err := os.ReadFile("algos/sample_plugin/sample_plugin.js")
if err != nil {
panic(err)
}
When I try to run this, I get the following errors:
GoError: Invalid module at github.com/dop251/goja_nodejs/require.(*RequireModule).require-fm (native)
Things I have tried:
goja
andgoja_nodejs
go mod tidy
.Can some one please help me?
The text was updated successfully, but these errors were encountered: