Fable: Build was not evaluated, expected the results to be ready after 'Eval'

Created on 4 Apr 2016  路  22Comments  路  Source: fable-compiler/Fable

Hello,

I seem to be having little luck using the fable-compiler package from npm (version 0.1.6 to be precise). The message I am getting is pretty vague and is as follows:

"Build was not evaluated, expected the results to be ready after 'Eval'"

I have tried attaching the vscode debugger to node, and it appears to be emitted from the process wrapper (i presume around Fable.exe, line 321 index.js). I wasn't quite sure how this is coupled to the node process in terms of parameters so I haven't dug any further yet, however any guidance would be appreciated if I can help get to the bottom of this.

I have tried running from both some local directory with a very simple .fsproj file, and also copying a .fs file directly into the global node modules folder (not sure if this is supposed to work, but either way the error message is the same). Interestingly .fsx files compile perfectly. I should probably also add that I have tried this on two very different environments (one win7 behind heavy corp proxy - node 4.4, second is win 10 with node 5.5, no restrictions) and both behave the same.

On a side note though, awesome work! I have been waiting for something like this for a long time.

Most helpful comment

Genius, thank you!

I went through all your changes one by one and the magic line was indeed
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />

Now I can actually use this :)

All 22 comments

Thank you very much for your feedback. Could you please provide the following info?

  • Did you install fable-compiler globally?
  • Command you used (e.g., fable src/MyProject.fsproj --outDir out)
  • fableconfig.json if any
  • If possible, can you post the project to a gist?
  • The exact output of the compiler (for example, do you see Start compilation...?)

Sorry for the hustle and thanks a lot in advance!

Ok I think I have the simplest scenario feasible here:
https://gist.github.com/Metal10k/6c72f82b5922edea81bfc5413098c1d4

To answer your questions:

  • fable-compiler is installed globally (as per setup instructions 'npm install fable-compiler -g'
  • Commands tried

    • fable FableTest.fsproj > build was not eval error

    • fable Library1.fs > same as above

    • fable Script.fsx > amazingly this not only worked, but I just noticed it has successfully compiled everything else.

I did also try using the --outDir but this did not seem to affect the behaviour

Here is the full console output:

D:\VSProjectsWorkingGIT\Sandbox\FableTest\6c72f82b5922edea81bfc5413098c1d4
> fable FableTest.fsproj
Start compilation...
Build was not evaluated, expcted the results to be ready after 'Eval'.

 D:\VSProjectsWorkingGIT\Sandbox\FableTest\6c72f82b5922edea81bfc5413098c1d4
> fable Library1.fs
Start compilation...
Build was not evaluated, expcted the results to be ready after 'Eval'.

D:\VSProjectsWorkingGIT\Sandbox\FableTest\6c72f82b5922edea81bfc5413098c1d4
> fable Script.fsx
Start compilation...
Compiled Library1.fs at 10:18:25 PM
Compiled Script.fsx at 10:18:25 PM

D:\VSProjectsWorkingGIT\Sandbox\FableTest\6c72f82b5922edea81bfc5413098c1d4

I am wondering if perhaps the underlying executable is behaving different when installed globally as opposed to using npm link? I will try and test this tomorrow.

Let me know if you need anything else.

Sorry @Metal10k, but your test did build just fine here :(

D:\Temp\MetalKTest>fable FableTest.fsproj
Start compilation...
Compiled Library1.fs at 21:00:56

D:\Temp\MetalKTest>fable Script.fsx
Start compilation...
Compiled Library1.fs at 21:14:10
Compiled Script.fsx at 21:14:10

Using latest published fable (0.1.6) installed via npm install fable-compiler -g

Also, I didn't find this error message ("Build was not evaluated, expcted the results to be ready") anywhere in Fable source code, but a search into Google pointed me to here:

https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/vs/IncrementalBuild.fs

I'm using F# 4.0 (FSharp.Core 4.4.0.0) from Visual Studio 2015 Community Edition Update 1. Could you provide more info about your environment?

As a guess, please try to update your FSharp compiler.

Looks like your right. It appears the fsharp compiler is throwing the error.

My environment is as follows:
Win10:
Vs2015 express update 1, f# 4.0

Win7:
VS2015 pro update 1
f# 4.0 FSharp.Core 4.4.0.0 (although 3.0 and 3.1 are also available)

This is actually what is listed in the .fsproj file, so unless fable is perhaps picking up an old version of the compiler somehow?

I also tried adjusting the .net framework version but this appeared to have little effect. I will keep looking.

I should probably add:
\Roaming\npm\node_modulesfable-compilerbin\

contains:

  • FSharp.Core.dll version 4.4.0.0
  • FSharp.Compiler.Service 2.0.0.6
    which I assume are the used binaries.

Are these copied from the local fsharp compiler install or are they added via npm?

Thanks a lot for the detailed info! My suspicion is the problem comes from the AssemblyInfo.fs file (that's why Script.fsx compiles without problem, as it doesn't include this file). I need to debug it a bit more to understand the problem but probably the solution would be to ignore AssemblyInfo.fs files.

Also, it's only possible to compile .fsproj and .fsx files, so fable Library1.fs won't work. I have added an extension check to give a more explanative message when this occurs :+1:

I have updated the gist to exclude all .fs files from the fsproj file. Unfortunately I am still getting the same error, so it would appear that is not the issue.

I also experimented with removing all references except FSharp.Core and mscorelib, same issue remains.

On a side note, it may be worth adding a note to the getting started instructions just to make clear the limitations of using .fs files in fsproj's, as I assumed (as others likely will) this would work.. unless you are referring to .fs files can be compiled just only in the context of a project?

Compiling a script with a reference to a .fs file worked perfectly by the way.

Thanks for your effort in locating the error, I really appreciate it :) I'm gonna try to reply to your questions:

\Roaming\npm\node_modulesfable-compilerbin\ contains FSharp.Core and FSharp.Compiler.Service

Yes, these libraries are from the npm package. But I think FSharp.Compiler.Service calls the locally installed F# compiler at the end and maybe this is where the problem comes from.

.. unless you are referring to .fs files can be compiled just only in the context of a project?

Yeah, sorry I was unclear. I meant you cannot pass a .fs file directly to the compiler, only .fsproj and .fsx. But of course you can reference .fs files in the project context.

I'll upload a new version today or tomorrow. Not sure if it will solve the problem but I'll let you know so you can give it a new try in case it _magically_ works.

In any case, it seems to be a problem with the FSharp.Compiler.Service. If the problem persists we can report it in their repo:
https://github.com/fsharp/FSharp.Compiler.Service/blob/master/src/fsharp/vs/IncrementalBuild.fs#L1651

Excellent. I will give the new version a whirl when its up.
Thanks again, appreciate the help!

Version 0.2.0 has been loaded to npm. Not sure if this will solve the problem but please give it a try. If there's no luck we can report the problem in the FSharp.Compiler.Services repo.

I have just run the test again with 0.2.0 and unfortunately the problem still appears to exist, so I guess this may be related to FSharp.Compiler.Services as you suspected. On that note, do we know exactly what is being passed to the compiler, and is anyone else able to replicate this? I am not sure I really understand exactly what is going on beyond the .exe, so not entirely sure where to start.

I updated my Visual Studio 2015 to Update 2, Fable to 0.2.0 and the files of your gist. And now I can reproduce the problem (when compiling the .fsproj):

D:\Temp\MetalKTest>fable FableTest.fsproj
Start compilation...
Build was not evaluated, expcted the results to be ready after 'Eval'.

But not when compiling the .fsx file:

D:\Temp\MetalKTest>fable Script.fsx
Start compilation...
Compiled Script.fsx at 06:20:49

Can you confirm that the second test (fable Script.fsx) is failing in your machine?

The first test is expected to fail, since FSharp compiler simply has... nothing to do. ;)

Your .fsproj have only one .fsx script, which are not marked as "compile" by default. After changing this line to

<Compile Include="Script.fsx" />

It worked for me:

D:\Temp\MetalKTest>fable FableTest.fsproj
Start compilation...
Compiled Script.fsx at 06:32:33

Generated Script.js:

(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports);
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports);
    global.unknown = mod.exports;
  }
})(this, function (exports) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  var a = exports.a = 1;
});

That is interesting.

To be clear, running the command 'fable Something.fsx' passes. The project was failing, but this was also happening when there were .fs files in the project.

Have you tried rolling back a commit and rerunning the test? (these files were removed to simplify the surface area of the problem, possibly a bad idea in hindsight).

I am just looking at the project now and these .fs files are definitely set to 'Compile'.

I have also just tested adding to the fsproj on the current commit and I am still getting the same error. It seems like there might be some subtle difference between our environments?

Have you tried rolling back a commit and rerunning the test?

Yes. I did test your current gist with Fable 0.1.6 and 0.2.0 and both went fine .

I am just looking at the project now and these .fs files are definitely set to 'Compile'.

Could you please post this project into a new gist? It appears the problem may be in the .fsproj file.

Ah sorry I was actually referring to the first commit on the gist fce04a4572a39ef5bebb2bc8fe9ea48235f5b1e7. I have also pushed the update containing your proposed change. This fails for me.

I see. Unfortunately I cannot reproduce the problem anymore. I did run all versions of your gist in two different computers (one with Visual Studio 2015 Update 1 and other with Update 2) with success. Could you try to run it in another machine? With a clean install of Visual Studio or maybe plain F# compiler, if possible?

I'm very sorry I cannot help much more. I'm out of ideas now :(

No worries. Thanks for trying anyhow. I will try and find a fresh computer to try this on but i fear I might be out of options there too. The fact nobody else has had this is somewhat reassuring though, I guess there must be something strange about my environment(s).

I'm closing this issue for now. If you find any other way to reproduce the problem, please reopen it. (I would be glad to hear you solved it, anyway :) )

I had the same issue with the latest version (npm says its 0.3.2).

I have solved it by comparing the react example fsproj to mine. I have modified, the project guid and output type. made sure the fsx file is marked as compiled and added the condition to the import of fsharptargetpath project.

<ProjectGuid>1e44403b-7834-4842-91b1-53a5fa731c58</ProjectGuid>
<OutputType>Exe</OutputType>
<ItemGroup>
   <Compile Include="App.fsx" />
</ItemGroup>
...
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />

with such project file the compilation works fine. If you are referencing other projects (in my case I am referencing f# lib with common code), make sure that the Condition is in all projects:

Just look for this line

<Import Project="$(FSharpTargetsPath)"/>

And replace it with:

<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />

That's very useful for users having the same problem in the future. Thanks a lot for sharing!

Genius, thank you!

I went through all your changes one by one and the magic line was indeed
<Import Project="$(FSharpTargetsPath)" Condition="Exists('$(FSharpTargetsPath)')" />

Now I can actually use this :)

Another user has informed that this error seems to be fixed by adding fsc.exe to the PATH. If you face the problem again, could you please give it a try? Cheers!

Was this page helpful?
0 / 5 - 0 ratings