skip to Main Content

I ran into an issue after I did flutter pub add flutter_tts. when building, it immediately started giving a weird CMake build error (which I don’t understand), making the build fail. It looks similar to https://github.com/flutter/flutter/issues/95898, but that’s in a different package. I’m hoping that someone can provide some clues as to what is going on here and how I might be able to fix it. (so I can continue to work on my app). here’s the error that I’m encountering:

Launching libmain.dart on Windows in debug mode...
NUGET.EXE not found.
CMake Error at flutter/ephemeral/.plugin_symlinks/flutter_tts/windows/CMakeLists.txt:9 (message):
Please install this executable, and run CMake again.
Please install this executable, and run CMake again.
Error: Unable to generate build files
Exited (1).

I tried to install nuget.exe and add the folder of the location of nuget.exe to PATH, but that didn’t fix the issue.

2

Answers


  1. Chosen as BEST ANSWER

    What worked for me:

    1. download nuget.exe from https://www.nuget.org/downloads
    2. put nuget.exe in C:/Windows/System32
    3. restart VSCode
    4. run flutter clean
    5. run flutter pub get
    6. try to start a new debug session. it should work now.

  2. The error you’re encountering is related to CMake needing nuget.exe (a package manager for .NET) to install dependencies, and it seems like nuget.exe is not found on your system. This is a common issue when working with Flutter on Windows, especially when building plugins like flutter_tts.

    Here’s how you can resolve this:

    Steps to fix the issue:
    Install NuGet:

    Go to NuGet’s official download page and download nuget.exe.
    Place the nuget.exe file in a directory that’s in your system’s PATH environment variable, or a directory you can easily reference.
    Add NuGet to your PATH (if needed):

    Right-click on "This PC" or "Computer" on your desktop or in File Explorer.
    Choose Properties.
    Click Advanced system settings on the left.
    In the System Properties window, click the Environment Variables button.
    In the Environment Variables window, under System Variables, find Path, select it, and click Edit.
    Add the directory where you placed nuget.exe (e.g., C:ToolsNuGet) to the Path and click OK.
    Run CMake manually:

    After adding nuget.exe to your Path, go back to your Flutter project and clean it by running:

    flutter clean
    

    Then, run the following command to rebuild the project:

    flutter build windows
    

    Install any missing dependencies:

    If the build still fails, you may need to manually install any dependencies using nuget.exe. You can do this by running:

    nuget install <package-name>
    

    for any packages mentioned in your CMake error.
    Ensure all required tools are installed:

    Make sure that your system has all the required tools for building Windows apps with Flutter:
    Install Visual Studio 2019/2022 with the Desktop development with C++ workload.
    Ensure that you have CMake installed and available in your system’s PATH.
    Restart your IDE/Editor:

    After completing the above steps, restart your IDE (VS Code, Android Studio, etc.) and try to build the project again.
    These steps should help resolve the nuget.exe missing issue and allow CMake to generate build files successfully.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search