ghcjs could not be determined
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.
Rerun it....a lot.
Or, downgrade node to 5.0 or below.
https://github.com/commercialhaskell/stack/issues/1629
This is more pertinent: https://github.com/commercialhaskell/stack/issues/1496
Here's an example of a working GHCJS build with reflex-dom and stack. YMMV: https://github.com/3noch/reflex-dom-xhr-delay
Definitely don't mind downgrading node. Does https://github.com/3noch/reflex-dom-xhr-delay work on the ghcjsi branch per chance?
I haven't tried it; sorry!
You'd need to get an sdist of that branch somehow.
Re-ran it a lot, officially stuck on kan-extensions, "cannot find ghcjs" occurs every time on it, bleh. Downgrading node. Stay tuned folks.
@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?
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.
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 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? =)
:weary:
@3noch, got it working now, @luigy had the magic formula, npm i [email protected].
@luigy seems to conjure much magic. ;)
Thanks for blazing a trail for me! :grin:
@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:
:heart_eyes:
:v:
@3noch, @luigy might have a present for us.... :gift: