free geoip
154

Fix “Dart Not Recognized” Error on Windows

Are you seeing the message “dart is not recognized as an internal or external command” when trying to run Dart…

Are you seeing the message “dart is not recognized as an internal or external command” when trying to run Dart or Flutter commands on your terminal or command prompt? This is a common issue for developers who just installed Dart SDK or Flutter on Windows, and it usually means your system cannot locate the Dart executable.

dart not recognized as internal or external command

Why the Error Happens

The most common cause of this error is that the Dart SDK path is not correctly added to the system’s Environment Variables. When you run a command like dart --version, your terminal needs to know where dart.exe is located.

How to Fix the Error

Here’s how to fix it in a few simple steps:

  1. Locate Dart SDK Path
    • If you installed Flutter, Dart SDK is located inside the flutter/bin/cache/dart-sdk/bin folder.
    • If installed separately, it might be in C:\tools\dart-sdk\bin or a similar directory.
  2. Add Dart to Environment Variables
    • Open Windows Search > type Environment Variables.
    • Click Edit the system environment variables.
    • In the System Properties window, click Environment Variables.
    • Under System variables, find and select Path, then click Edit.
    • Click New, and paste the Dart bin path (e.g., C:\tools\dart-sdk\bin).
    • Click OK > OK > OK to save.
  3. Restart Your Terminal
    • Close and reopen your command prompt or IDE (such as VS Code).
    • Run dart --version again to verify.

Verify Dart Installation

To confirm if Dart is now recognized, run:

dart --version

If installed correctly, you’ll see the Dart SDK version info.Related Issues

Sometimes, this issue is also seen with flutter commands. Make sure the Flutter SDK path is also added to the environment variables similarly.

Use DartPad for Quick Testing

If you’re in a hurry and just want to run Dart code without installing anything, try using DartPad, the official online Dart editor.

By correctly setting up your environment path, you can avoid this common error and start building Dart or Flutter applications smoothly.

rysasahrial

Leave a Reply

Your email address will not be published. Required fields are marked *