VS Code-'dart' is not recognized as an internal or external command, operable program or batch file - dart

I am trying to install flutter and run the basic flutter example on visual studio code . I used flutter doctor in the command line and installed all the missing requirements , now i try to run a basic program in flutter ,but in visual studio code output i get the following error
[Running] dart "c:\fluttercode\mobile_test1\lib\main.dart"
'dart' is not recognized as an internal or external command,
operable program or batch file.
[Done] exited with code=1 in 64.965 seconds
I could find only one question similar to this in stack overflow ,
Visual Studio Code: dart not found
they told to change environment variables ,i added the environment variables (however the name of the environment variables was not mentioned in the answer )
I checked the dart site in case they mentioned it ,but i couldn't find anything related to the name of the environment variable
This is what i got from dart site
Windows:
In Windows, setting your PATH and environment variables can be done by opening Control Panel and typing “Environment” and then clicking the “Edit the system environment variables” option. You’ll be presented with a list of environment variables including PATH where you can edit or add new ones.
Note: You should reboot your computer after making changes to PATH to ensure all processes (including explorer) are updated.
So i just did a guess and added an environment variable with the name FLUTTER_ROOT(cause i remember reading somewhere in one of the settings in VS Code for dart ,this name was used) and pointed it to my flutter bin directory
I restarted my PC and opened vs code and changed in VS Settings >user settings>dart and flutter>Dart:Env and updated my path
{
"files.autoSave": "afterDelay",
"dart.flutterSdkPath": "C:\\src\\flutter\\bin"
}
But i get the same error
this is how my flutter bin folder looks like
Environment variables in PATH after installing Dart

You don't have to install the dart SDK if you already have the flutter SDK installed. When you specify the path of flutter, VSCode only recognizes the flutter commands and not the dart commands. What you should do is change the system environment variables (type env in the windows search bar) and add the dart sdk inside the PATH variable. The dart sdk is usually found inside /bin/cache/dart/bin. This worked for me, so give it a try

Try to add the flutter\bin sdk path and also the windows\system32 path to the user variables and/or system variables.

I had the same problem. Here is how I resolved it.
Download and extract dart sdk (I used the stable release)
https://v1-dartlang-org.firebaseapp.com/install/archive
add the dart sdk bin folder to your path
after you have added it to your path run
flutter pub global activate webdev
now i can run
webdev serve
without error.

I'm using windows so I used choco install dart-sdk -<version> to install dart through the powershell in admin mode. That got rid of my error

Installing flutter is not enough. You need to install the dart sdk.
Pre-req: Make sure you have Chocolatey installed on your machine.
Run "choco install dart-sdk" from an elevated prompt.
Restart vscode.
That did it for me.

I went to the dart website and searched for the dart sdk.
i then chose the option to install dart using setup wizard.
After running the executable file on my laptop it took some time to download all the files but once the setup was complete the error no longer occurred and i was able to run the code successfully.
Downloading dart setup from dart website
Installing using setup wizard

Related

Dart commands not running in windows 11. What do I do to make it run?

Dart command is not running on
Windows 11, what should I do?
Dart is not a recognized internal or external command, batch file
Add the path of the bin folder of the Dart SDK to the PATH environment variable of the current user (Windows key+S, type environment).
This happens if dart is not in your PATH.
Open cmd
Enter the command rundll32 sysdm.cpl,EditEnvironmentVariables
Double click on Path and add the location of the dart binaries you installed at the bottom of the list.
Close all terminal windows and reopen.

Electron - build an installer for Windows x64 on Mac

I am new to electron and trying to build a windows installer for the electron app using my mac. I am using electron-packager to package the app and then electron-wix-msi to build the installer. When the build installer steps are executed, the error Unable to read file info from exe. Falling back to packaging description. Error: spawn Unknown system error -86 is thrown. please see the full error message in the attached screenshot.
I would like to highlight that when I build an installer for macOS, it works. Should I understand that I can not build a windows installer using mac?
build_installer64.ts file:
You can't do that, you have to do this on the Windows platform.
I use GitHub Actions to build my app for each platform, code for Windows:
https://code.korbsstudio.com/KorbsStudio/electron-builder-sample/-/blob/main/.github/workflows/build.yml#L52-71
Optionally, you can also use a Windows virtual machine and repeat the same process in there.
Update, for those interested in doing this on Linux, building a EXE setup file seems to be possible. You'll need to have wine installed and use:
npx electron-builder build --win

Install version cordova-ios 4.3.0 for visual studio and issue with cordova command not existing in CLI

Someone has asked the exact question I need on this page.
However, as I am new, my rep will not allow me to comment yet! So I have had to create a new question.
A guy in the question linked above suggests to "Type cordova platform add ios;". So there I suppose is where my question is different.
When I type Cordova in cmd prompt, I get a message saying "cordova is not recognized as an internal or external command, operable program or batch file."
Update: Please note, I have followed these steps: http://cordova.apache.org/docs/en/7.x/guide/cli/ And I am able to run the npm commands in CLI. I was hoping to simply update my ios version only.
I have also looked up PATH but I have no idea where to start, problem is, people suggest that I shouldn't need to adjust PATH as running the CLI commands to install the Cordova CLI should just allow me to use it?
So to summarize:
I downloaded the node.js and installed it
I typed this into cmd "npm install -g cordova" which installed
I type "cordova" and get my "cordova is not recognized as an internal or external command" message above
My aim is to upgrade my cordova-ios 4.2.0 to cordova-ios 4.3.0 to fix my main error of "remote build requires your projects to use cordova-ios 4.3.0 or greater with XCode 8.3"
Update 2 9th oct 2017:
I have given up for now with the above, to work around this i installed Node.js 8.6.0 then updated cordova using npm... im now facing some more issues that I am again stuck on and will create a new question.
Hopefully in the meantime, someone can answer this question and i can try again.
I suspect my issues could be relating to the fact i installed VS 2017 and used all the built in nuget packages (for cordova and node.js) and they are conflicting with the manual way in some way (i suspect that, as running the "cordova" command on my other PC worked fine!)

Dart editor run error "could not start pub serve or connect to pub" on it's sample web application project

I just installed Dart Editor and created a simple web application and when I click on run it shows this error and nothing happens.
"could not start pub serve or connect to pub"
How is the configuration of dart editor for Windows7 sp1 64bit?
What am I supposed to do to run the sample project?
It is a common problem
http://dartbug.com/20771 (mentions that an internet connection is necessary)
http://dartbug.com/19659
http://dartbug.com/19847
http://dartbug.com/19656 (it was mentioned that reinstall Dart helped)
Nothing contains a good solution.
For weird problems it's always worth to try pub cache repair on the command line.

Unable to find ant program

I am an experienced (but retired) Windows software developer, with more years experience than I care to admit, developing in C++, C#, VB and Java. I therefore decided to have a crack at Android development. My development machine is a Windows 7 box. My IDE of choice would be Microsoft Visual Studio but, for now, I am happy doing hand editing and launching tools from the command line.
I started by downloading the Android SDK and various additional items it suggested. I then started working my way through the tutorial at developer.android.com/training/basics/firstapp. Android list targets gave me a couple of choices (Android 4.2.2 and Google APIs:17). I then did Android create project from the command line and that appeared to do its stuff, creating MyFirstApp in my development folder. I then ran Android avd and created an emulator. I also added the android SDK's tools and platform-tools to my path. So far so good.
I fell at the next hurdle. The tutorial told me to change to the root folder of my project and run ant debug. At this point, Windows reports:
'ant' is not recognized as an internal or external command,
operable program or batch file.
I've searched around for ant.exe without success. Did I miss installing something or did I miss a vital step in the set-up? Any advice for this very green newbie would be greatly appreciated.
There is no ant.exe. Only ant.bat. Ant is a Java build tool.
If it comes with the Android SDK, make sure its bin directory is in your PATH environment variable. Otherwise, download it (from [http://ant.apache.org][1]), and follow the installation instructions on the web site.
Normally, simply unzipping it, putting its bin directory in the PATH envieonment variable, and setting a JAVA_HOME environment variable that points to your preferred JDK directory is sufficient.

Resources