Skip to content

dotnet fable doesn't exit #4326

Closed
Closed

Description

@abaljeu

Following the exact instructions here (except the project name) : https://fable.io/docs/getting-started/your-first-fable-project.html

And it ends with:

$ dotnet fable
Fable 4.28.0: F# to JavaScript compiler
Minimum @fable-org/fable-library-js version (when installed from npm): 1.11.0

Thanks to the contributor! @ncave                                                           =true -p:
Stand with Ukraine! https://standwithukraine.com.ua/

Parsing gambol.fsproj...
.> cmd /C dotnet restore gambol.fable-temp.csproj -p:FABLE_COMPILER=true -p:FABLE_COMPILER_4=true -p:FABLE_COMPILER_JAVASCRIPT=true
Restore complete (1.0s)

Build succeeded in 1.7s

And I never get the cursor back. Here's what's been generated in my project. bin/debug/net10.0 is empty.

Image

Activity

  1. abaljeu commented on Jan 5, 2026

    @abaljeu
    Author

    Updating fable to 5.0.alpha-19 eliminated this issue. Thanks to the person who suggested this. But for any first timers with fable, the default really deserves to work.

  2. MangelMaxime commented on Jan 6, 2026

    @MangelMaxime
    Member

    Hello,

    What version of .NET are you using?

    dotnet --version
    dotnet --list-sdks
  3. abaljeu commented on Jan 6, 2026

    @abaljeu
    Author

    10.0.101

  4. MangelMaxime commented on Jan 7, 2026

    @MangelMaxime
    Member

    I am not able to reproduce locally.

    ❯ git clean -xdf
    Removing Library.fs.js
    Removing bin/
    Removing fable_modules/
    Removing obj/
    ❯ dotnet tool restore
    Tool 'fable' (version '4.28.0') was restored. Available commands: fable
    
    Restore was successful.
    ❯ dotnet fable --version
    4.28.0
    ❯ dotnet --version
    10.0.101
    ❯ dotnet fable
    Fable 4.28.0: F# to JavaScript compiler
    Minimum @fable-org/fable-library-js version (when installed from npm): 1.11.0
    
    Thanks to the contributor! @justinjstark
    Stand with Ukraine! https://standwithukraine.com.ua/
    
    Parsing fable-net-10-bug.fsproj...
    .> dotnet restore fable-net-10-bug.fable-temp.csproj -p:FABLE_COMPILER=true -p:FABLE_COMPILER_4=true -p:FABLE_COMPILER_JAVASCRIPT=true
    Restore complete (0.2s)
    
    Build succeeded in 0.3s
    .> dotnet restore /home/mmangel/Workspaces/test/fable-net-10-bug/fable-net-10-bug.fsproj
    Restore complete (0.3s)
    
    Build succeeded in 0.4s
    Project and references (1 source files) parsed in 1625ms
    
    Started Fable compilation...
    Compiled 1/1: Library.fs
    Fable compilation finished in 513ms

    Something that is strange in your output is this line:

    Thanks to the contributor! @ncave                                                           =true -p:

    in theory you should have something like:

    Thanks to the contributor! @justinjstark
    Stand with Ukraine! https://standwithukraine.com.ua/
    
    Parsing fable-net-10-bug.fsproj...
    .> dotnet restore fable-net-10-bug.fable-temp.csproj -p:FABLE_COMPILER=true -p:FABLE_COMPILER_4=true -p:FABLE_COMPILER_JAVASCRIPT=true
    Restore complete (0.2s)

    But I don't know what could be the cause of that here.

  5. goswinr commented on Jan 29, 2026

    @goswinr
    Contributor

    In #4176 (comment) 4.28 also doesn't exit. maybe 4.28 should be deprecated ? @MangelMaxime

  6. GraanJonlo commented on Jan 29, 2026

    @GraanJonlo

    I am having the exact same issue with 4.5.0

  7. ag2uinsure commented on Jan 29, 2026

    @ag2uinsure

    *4.2.8

    No problem if I downgrade to 4.2.7

  8. MangelMaxime commented on Jan 29, 2026

    @MangelMaxime
    Member

    @goswinr For me 4.28 works as expected with .NET 10 or .NET 8.

    This version add supports for .NET 10, so it cannot be replaced by a previous version.

    For this reason, I don't think I can unlist it. It seems like previous version of Fable are also impacted by this bug, but I can't see a reason why this is happening. And as I cannot reproduce the issue, I can't investigate it ... 😕

    It could be of great help if someone having the bug with Fable 4.28 could try to run/debug Fable from the fable4 branch. The first steps could be to see if they are able to compile against the quicktest project (command should be ./build.sh quicktest javascript, you can refers to ./build.sh --help)

  9. MangelMaxime commented on Jan 29, 2026

    @MangelMaxime
    Member

    Just in case, which operating system are you all using ? Windows? Mac? Linux?

  10. goswinr commented on Jan 29, 2026

    @goswinr
    Contributor

    win 11, but I am on 5.22 now. where all is good, so it's not critcal to me

  11. abaljeu commented on Feb 13, 2026

    @abaljeu
    Author

    Specifically, it's the invocation of cmd /C that's the issue. If I do that myself, cmd doesn't terminate. dotnet restore does terminate if I don't bother using cmd /C.

  12. MangelMaxime commented on Feb 13, 2026

    @MangelMaxime
    Member

    @abaljeu You mean if you run cmd /C dotnet restore it does not terminate but if you do dotnet restore it does ?

  13. MangelMaxime commented on Feb 13, 2026

    @MangelMaxime
    Member

    @abaljeu What terminal are you using to run Fable from?

    Is it cmd, powershell, git bash, etc. ?

  14. abaljeu commented on Feb 13, 2026

    @abaljeu
    Author

    Windows 10 or 11. Happens regardless of using cmd, git bash or cursor's ai choice of shell. But i think the clesr culprit is how cmd /C works. Maybe its related to the setting that has terminals not close when finished until you press a key. Maybe this could be fixed by just running dotnet tools without invoking cmd to run it.

  15. abaljeu commented on Feb 13, 2026

    @abaljeu
    Author

    @abaljeu You mean if you run cmd /C dotnet restore it does not terminate but if you do dotnet restore it does ?

    Yes

  16. MangelMaxime commented on Feb 13, 2026

    @MangelMaxime
    Member

    Hum 🤔

    I suspect the reason why we are using cmd /C is because it is often written that we need to use that in order to run .bat or .cmd files.

    However, when I was on Windows I almost never needed to manually call cmd /C myself, I don't know if this was because I was already in a terminal or not however.

    Trying to remove cmd /C when running dotnet fable watch --run vite surfaced an issue where we tried to run ../node_modules/.bin/vite

    Cannot run: An error occurred trying to start process '..\node_modules.bin\vite' with working directory 'C:\Users\mmangel\Workspaces\Github\fable-compiler\template-gitpod-fable-4-vite-react\src'. The specified executable is not a valid application for this OS platform.

    This is because --run CLI options tries to resolve the NPM executable:

        let tryNodeModulesBin workingDir exeFile =
            tryFindPackageJsonDir workingDir
            |> Option.bind (fun pkgJsonDir ->
                let nodeModulesBin = Path.Join(pkgJsonDir, "node_modules", ".bin", exeFile)
    
                if File.Exists(nodeModulesBin) then
                    Path.GetRelativePath(workingDir, nodeModulesBin) |> Some
                else
                    None
            )

    Personally, I always found --run and the fact that we try to be smart in the executable resolution a not too good idea.

    IHMO --run XXX should be equivalent as running XXX in the terminal.

    So in the case of the command above people should use dotnet fable watch --run npx vite. Because, npx is globally available is knows how to resolve to find vite executable either locally, globally or from the network.

    Changing this behavior would be a breaking change, so we need to be sure of us. For Fable 5, we can make the decision more or less easily because this is already a new major version.

    But it seems like we don't have the issue with Fable 5, as you said moving to Fable 5 fixed the problem...


    @abaljeu You mean if you run cmd /C dotnet restore it does not terminate but if you do dotnet restore it does ?

    Yes

    What I don't understand is that on my Windows machine, I am not able to reproduce this issue in CMD or PowerShell terminal. 🤔

  17. abaljeu commented on Feb 14, 2026

    @abaljeu
    Author

    This could be important: I'm inside a vscode terminal. Should have mentioned that up front. I might be able to work around the issue by changing the context of the command. instead of dotnet fable maybe i can execute fable more directly. Possibly the issue is mishandling of stdin/stdout on the embedded xterm, relative to what cmd.exe expects. Possibly a workaround is redirecting stdin/out.

  18. dewf commented on Mar 16, 2026

    @dewf

    I was having this problem myself, and was diving deep into the weeds (to provide as much useful detail as possible in the thread here).

    ... then I noticed, after downgrading to 4.27, that it wasn't hanging, but it did complain that it couldn't parse my .fsproj file. Hmm 🤔

    So I went in there and changed TargetFramework from net10.0 to net8.0 ... and not only does that work with 4.27, but it also fixes the problem with 4.29 hanging! 😮

    (net9.0 also works)

    I can still provide some of the original problem-detail I was going to post, but for my purposes this is a very acceptable fix.

  19. MangelMaxime commented on Mar 16, 2026

    @MangelMaxime
    Member

    @dewf Does Fable RC works for you?

  20. dewf commented on Mar 16, 2026

    @dewf

    @MangelMaxime yes, 5.0.0-rc.3 works with the net10.0 .fsproj as well.

  21. MangelMaxime commented on Mar 16, 2026

    @MangelMaxime
    Member

    Thank you for confirming.

    As Fable 5, will soon be released as stable I encourage people to use that version or to the fix mentioned by @dewf by downgrading the TargetFramework version.

  22. MangelMaxime commented on Jun 29, 2026

    @MangelMaxime
    Member

    Fable 5 has been release as stable.

    If the issue still happens feel free to re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions