Code Monkey home page Code Monkey logo

Comments (12)

rtfeldman avatar rtfeldman commented on August 17, 2024

Thanks for the suggestion!

It actually used to do this, but I don't like the idea of it silently switching to a different compiler from the one on your PATH. That's the sort of thing that saves a few seconds 9 times out of 10, and then eats an entire day the 10th time because that's the last thing you'd think to check for the behavior you're seeing. 😉

For that reason I'd rather we stick to the current design.

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024

I understand what you mean and I'm fine with it only looking in PATH but in this case elm-make is indeed in my PATH, it is the default binary outside of elm-test since I have the following in my profile file:

PATH=node_modules/.bin:$PATH

If I do which elm-make it does give me node_modules/.bin/elm-make, so shouldn't elm-test find it in this particular case?

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

Got it - yeah I'd expect it to.

What happens if you run the example code in the README of https://github.com/rtfeldman/node-elm-compiler - does that work?

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024

Hm this is what I get, but I also have elm installed globally as fallback

$ node compileHelloWorld.js
Error: You are using Elm 0.18.0, but this project is saying it needs a version
in this range: 0.17.0 <= v < 0.18.0

This means this package has not been upgraded for the newer version of Elm yet.
Check out the upgrade docs for guidance on how to get things working again:
<https://github.com/elm-lang/elm-platform/tree/master/upgrade-docs>


Finished with exit code 1
(node:44904) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Compilation failed
[...]

This is if I uninstall my global elm install:

$ node compileHelloWorld.js
Could not find Elm compiler "elm-make". Is it installed?

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024
  • Without npm i elm -g I get the same thing as above (Could not find Elm compiler)
  • With it seems to compile fine I think, I get a good dozen lines of JS so I think that's the expected output
  • If I do npm i elm (locally then) I also get could not find compiler

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

So here's the output I get if I try to npm install elm without -g:

$ which elm-make
/usr/local/bin/elm-make
$ npm remove -g elm
$ npm install elm
$ which elm-make
elm-make not found
$ npm install -g elm
/usr/local/bin/elm-make

It's definitely not ending up on my path. I'm curious why it'd be different for you... 🤔

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024

Because I set it up like so, I put PATH=node_modules/.bin:$PATH in my .zprofile file (or .bash_profile). It's a common setup to avoid having to type node_modules/.bin all day, same for other package managers:

~/.zprofile

## Homebrew
PATH=/usr/local/bin:/usr/local/sbin:$PATH

## NPM
PATH=node_modules/.bin:$PATH

## Composer
PATH=vendor/bin:$HOME/.composer/vendor/bin:$PATH

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

Ah, got it.

Okay, I wonder if somehow that PATH is not making it into Node properly.

When you run node -p process.env.PATH do you see node_modules/.bin in the output?

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024

As far as I can see yes, so that's even weirder :D

$ node -p process.env.PATH
/Users/anahkiasen/bin:/usr/local/bin:vendor/bin:/Users/anahkiasen/.composer/vendor/bin:node_modules/.bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/anahkiasen/.composer/vendor/bin

$ node --version
v7.2.0

from node-test-runner.

rtfeldman avatar rtfeldman commented on August 17, 2024

Aha! This might be it: http://stackoverflow.com/questions/9679932/how-to-use-package-installed-locally-in-node-modules

When it runs elm-make it has to set the cwd to be the directory of the elm-package.json in question (in this case, presumably tests/elm-package.json), so unless tests/node_modules/bin exists, it won't be on the PATH as far as elm-test can tell.

What happens if you do npm install elm in the tests/ directory?

from node-test-runner.

Anahkiasen avatar Anahkiasen commented on August 17, 2024

That seems to work indeed so I'm guessing that is the issue. Abridged transcript:

$ elm-test
Could not find Elm compiler "elm-make". Is it installed?

$ cd tests && npm init -y && npm i elm

$ cd ..
$ elm-test
Running 3 tests. To reproduce these results, run: elm-test --seed 1831419900

from node-test-runner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.