sagiegurari / node-go-require

Load Google GO files as any javascript modules under nodeJS runtime.
Apache License 2.0
154 stars 10 forks source link

Error: Failed to convert Go file to JS #21

Open annie-elequin opened 2 months ago

annie-elequin commented 2 months ago

Describe The Bug

I run node index.js and it says "Failed to convert Go file to JS".

Info Macbook Pro M3Pro (2024) Sonoma 14.4.1 Node: v21.7.3 Go: 1.22.2

To Reproduce

I have included my minimal repo where this error happens. Just yarn and then node index.js

Error Stack

/Users/aelequin/coding/code-dump/node-go-require-test/node_modules/node-go-require/lib/go-loader.js:119
        throw new Error('Failed to convert Go file to JS\n' + output.stdout + '\n' + output.stderr);
        ^

Error: Failed to convert Go file to JS
null
null
    at GoLoader.runGoScript2JS (/Users/aelequin/coding/code-dump/node-go-require-test/node_modules/node-go-require/lib/go-loader.js:119:15)
    at GoLoader.loadGoScript (/Users/aelequin/coding/code-dump/node-go-require-test/node_modules/node-go-require/lib/go-loader.js:144:27)
    at Object.requireGo [as .go] (/Users/aelequin/coding/code-dump/node-go-require-test/node_modules/node-go-require/lib/node-go-require.js:66:14)
    at Module.load (node:internal/modules/cjs/loader:1205:32)
    at Module._load (node:internal/modules/cjs/loader:1021:12)
    at Module.require (node:internal/modules/cjs/loader:1230:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/Users/aelequin/coding/code-dump/node-go-require-test/index.js:3:13)
    at Module._compile (node:internal/modules/cjs/loader:1368:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1426:10)

Node.js v21.7.3

Code Sample

https://github.com/annie-elequin/node-go-require-test

sagiegurari commented 2 months ago

is gopherjs installed?

annie-elequin commented 2 months ago

hi @sagiegurari thanks for your response! I did run this: go get -u github.com/gopherjs/gopherjs and it is in go.mod, is there anything else I need to do? (I am new to go)