Elm 0.19 development

I am trying to develop an elm 0.19 application using create-elm-app@next but can just cannot figure out how to do it.

Behavior I am trying to replicate:

npm -i g create-elm-app@next
create-elm-app app
cd app
elm-app start

I have tried installing elm0.19 into shell and it seems to work ok but I still get issues when trying to use the create-elm-app package.

I have spent a couple evenings on this so any help would be appreciated

3 Likes

I guess the issue is that create-elm-app uses its own bundled elm
instead of the one on PATH:

And that one is not compiled for Nix. You would need to package it or
use something like Reimplement `npm install -g` with nix and bash — nick novitski

FWIW elm 0.19 was just recently merged into channels/nixos-unstable: https://github.com/NixOS/nixpkgs/pull/45448.

1 Like

Yeah I have installed it via unstable and it works but I want to use it with create-elm-app. I am trying out the solution mentioned with nix-npm-install.

I tried the way mentioned and came across this error:

elm@0.19.0-bugfix2 install /nix/store/6cy9ndg19wbwn2rsiacyrs0ar44i37j4-node-create-elm-ap
p-2.0.3/lib/node_modules/create-elm-app/node_modules/elm
> binwrap-install

sh: binwrap-install: command not found

npm ERR! Linux 4.14.54
npm ERR! argv "/nix/store/8icflc0s2g28016wn68iysmbmyn3nn51-nodejs-6.14.3/bin/node" "/nix/st
ore/8icflc0s2g28016wn68iysmbmyn3nn51-nodejs-6.14.3/bin/npm" "--registry" "http://www.exampl
e.com" "--nodedir=/nix/store/hh7pn17ksxpjl4p7z1bn7c3jrsj2gk4z-node-sources" "--production"
"rebuild"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! elm@0.19.0-bugfix2 install: `binwrap-install`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the elm@0.19.0-bugfix2 install script 'binwrap-install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the elm package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     binwrap-install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs elm
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls elm
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /nix/store/6cy9ndg19wbwn2rsiacyrs0ar44i37j4-node-create-elm-app-2.0.3/lib/node
_modules/create-elm-app/npm-debug.log
builder for '/nix/store/czrw0bjab39isk8a0pm5r52d093p4yl8-node-create-elm-app-2.0.3.drv' fai
led with exit code 1
error: build of '/nix/store/czrw0bjab39isk8a0pm5r52d093p4yl8-node-create-elm-app-2.0.3.drv'
failed

If I run via a package.json file I get this error:

unning /home/dylan/Desktop/elm-prisma/node_modules/create-elm-app/node_modules/.bin/elm make /home/dylan/Desktop/elm-prisma/src/Main.elm --debug --output /tmp/11887-24101-1ag4air.tg86.js
/home/dylan/Desktop/elm-prisma/node_modules/node-elm-compiler/index.js:103
      .on('error', function(err) { throw(err); });
                                   ^

Error: spawn /home/dylan/Desktop/elm-prisma/node_modules/create-elm-app/node_modules/.bin/elm ENOENT
    at _errnoException (util.js:992:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
    at onErrorNT (internal/child_process.js:372:16)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

And a popup dialog says failed to connect to localhost

Does anyone have any ideas? Thank you

How are you installing elm 0.19.0? I have spent several hours trying to get a shell working so I can contribute to a library and then be able to get my application finished.

@jonoabroad

I added nixpkg unstable then ran the following

nix-env -qaP elm

which gave:

nixos.elmPackages.elm    elm-0.18.0
nixpkgs.elmPackages.elm  elm-0.19.0

then I installed 0.19 with:

nix-env -i elm-0.19.0

1 Like

I was trying define derivations for create-elm-app but it seems to be quite hard and I don’t even use it myself so I passed it.

Anyway for anyone who really really just needs to make create-elm-app work on nixos this npm prefix workaround will workf for you.

$ mkdir ~/mutable_node_modules
$ npm config set prefix ~/mutable_node_modules 
$ npm install -g create-elm-app