try-stack-reflex icon indicating copy to clipboard operation
try-stack-reflex copied to clipboard

ghcjs could not be determined

Open dmjio opened this issue 9 years ago • 21 comments

It seems the planets have aligned against me in my quest for using ghci/ghcjsi with reflex-dom.

Ever seen this before?

    Configuring ghcjs-dom-0.2.2.0...
    setup-Simple-Cabal-1.22.4.0-ghcjs-0.2.0.20151001_ghc-7.10.2: The program
    'ghcjs' version >=0.1 is required but the version of
    /Users/dmj/.stack/programs/x86_64-osx/ghcjs-0.2.0.20151001_ghc-7.10.2/bin/ghcjs
    could not be determined.

dmjio avatar Feb 01 '16 21:02 dmjio

Rerun it....a lot.

3noch avatar Feb 01 '16 21:02 3noch

Or, downgrade node to 5.0 or below.

3noch avatar Feb 01 '16 21:02 3noch

https://github.com/commercialhaskell/stack/issues/1629

3noch avatar Feb 01 '16 22:02 3noch

This is more pertinent: https://github.com/commercialhaskell/stack/issues/1496

3noch avatar Feb 01 '16 22:02 3noch

Here's an example of a working GHCJS build with reflex-dom and stack. YMMV: https://github.com/3noch/reflex-dom-xhr-delay

3noch avatar Feb 01 '16 22:02 3noch

Definitely don't mind downgrading node. Does https://github.com/3noch/reflex-dom-xhr-delay work on the ghcjsi branch per chance?

dmjio avatar Feb 01 '16 22:02 dmjio

I haven't tried it; sorry!

3noch avatar Feb 01 '16 22:02 3noch

You'd need to get an sdist of that branch somehow.

3noch avatar Feb 01 '16 22:02 3noch

Re-ran it a lot, officially stuck on kan-extensions, "cannot find ghcjs" occurs every time on it, bleh. Downgrading node. Stay tuned folks.

dmjio avatar Feb 02 '16 00:02 dmjio

@3noch, @luigy, finally got it installed. But now the browser won't connect. Do I need to host the generated js? Or does ghcjsi do that for me when I call main from ghcjsi?

dmjio avatar Feb 02 '16 13:02 dmjio

Using main module: 1. Package `reflex-todomvc' component exe:reflex-todomvc with main-is file: /Users/dmj/Desktop/try-stack-reflex/.stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/src-bin/main.hs
Configuring GHCi with the following packages: reflex-todomvc
GHCJSi, version 0.2.0.20151007-7.10.2: http://www.github.com/ghcjs/ghcjs/  :? for help
[1 of 2] Compiling Reflex.TodoMVC   ( /Users/dmj/Desktop/try-stack-reflex/.stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/src/Reflex/TodoMVC.hs, interpreted ) [flags changed]
Linking Template Haskell (ThRunner1)

browser connected, code runs in browser from now on
[TypeError: socket.close is not a function]
TypeError: socket.close is not a function
    at Namespace.<anonymous> (/Users/dmj/.ghcjs/x86_64-darwin-0.2.0.20151007-7.10.2/ghcjs/irunner.js:81:14)
    at emitOne (events.js:90:13)
    at Namespace.emit (events.js:182:7)
    at Namespace.emit (/Users/dmj/Desktop/try-stack-reflex/.stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/node_modules/socket.io/lib/namespace.js:206:10)
    at /Users/dmj/Desktop/try-stack-reflex/.stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/node_modules/socket.io/lib/namespace.js:174:14
    at nextTickCallbackWith0Args (node.js:452:9)
    at process._tickCallback (node.js:381:13)
[2 of 2] Compiling Main             ( /Users/dmj/Desktop/try-stack-reflex/.stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/src-bin/main.hs, interpreted ) [flags changed]
Ok, modules loaded: Reflex.TodoMVC, Main.

dmjio avatar Feb 02 '16 13:02 dmjio

I wish I could help you here, but I've never tried this before. It doesn't make sense that you'd need to host the JS...if GHCJS is changing it... :/

3noch avatar Feb 02 '16 15:02 3noch

@3noch seems like socket-io version 10 has issues. I tried to downgrade but now getting npm issues. Why are we using node-js for this again? =)

dmjio avatar Feb 02 '16 16:02 dmjio

:weary:

3noch avatar Feb 02 '16 16:02 3noch

@3noch, got it working now, @luigy had the magic formula, npm i [email protected].

dmjio avatar Feb 02 '16 22:02 dmjio

@luigy seems to conjure much magic. ;)

3noch avatar Feb 02 '16 22:02 3noch

Thanks for blazing a trail for me! :grin:

3noch avatar Feb 02 '16 22:02 3noch

@3noch, for the full enchilada

brew upgrade node # ensure node > 5.5.0
git clone https://github.com/luigy/try-stack-reflex.git
cd try-stack-reflex
./try-stack-reflex ghcjsi # might have to do this more than once if you get the "ghcjs-cannot-be-determined" error
cd .stack-work/downloaded/bda697401c03aadbc22b5bd5370b38cc28d70496a2c96c81a391edba2f5519cc/
npm i [email protected]
NODE_PATH=./node_modules stack --stack-yaml=../../../stack-ghcjsi-improved-base.yaml ghci

Once in ghci

> main -- and `:r` on code changes

Then open up http://localhost:6400, and :palm_tree:

dmjio avatar Feb 02 '16 22:02 dmjio

:heart_eyes:

3noch avatar Feb 02 '16 23:02 3noch

:v:

dmjio avatar Feb 02 '16 23:02 dmjio

@3noch, @luigy might have a present for us.... :gift:

dmjio avatar Feb 03 '16 01:02 dmjio