"flutter doctor" not working - installation

I've downloaded Flutter SDK as mentioned on https://flutter.io/setup-windows/ and also extracted it. Now when I try to run any Flutter command on the flutter_console.bat or any other CLI the prompts starts blinking forever and nothing happens! I've set the path correctly. Did not find any help from web!

Try running the flutter_console.bat as Administrator

If you delete cache folder under bin to solve some installation issues, this cause a endless loop in flutter doctor. This was my case.

I had the same issue when my flutter directory wasn't located directly in my C:/ drive ("C:/flutter")

I hope you have installed plug-in of flutter and dart
for the working of flutter doctor you need to create system environment variables of - flutter, git , cmd and powershell
like show in image just copy paste path of
**your path may different **
example:
C:\flutter\bin
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Program Files\Git\cmd
C:\Program Files\Git\bin\git.exe

Encountered the same issue on windows. Try extracting the flutter folder in this path C:\Users\YourAccountName\AppData\Local.
Then edit your environment variable and add C:\Users\YourAccountName\AppData\Local\flutter\bin. This solved the issue for me.

I had the same problem, reason was our proxy. I unplugged the network cable and used mobile network of my smartphone via usb host function, that worked for me. After checking and configuring with flutter doctor every following attempt to start flutter doctor or flutter help was successful even with "normal" network.

I extracted flutter to C:\Program Files\ and had same problem. Running command prompt as Administrator did the trick for me. Or extract flutter to another dir where you don't need admin rights.

First, if in your system there is no git installed then first install git.
For my case, I just deleted the whole flutter folder. Download again, extract the folder, cut and paste to the c drive and then update both user variable path and system variable path. I added "C:\flutter\bin" this path inside user variable path and system variable path. Also make sure that:
C:\Windows\System32\WindowsPowerShell\v1.0
C:\Program Files\Git\cmd
C:\Program Files\Git\bin\git.exe
these paths are exist inside the system variable path. Finally I run "flutter doctor" and successfully it run. I also check "dart --version" and there is no problem.
(if you have any confusion about user variable path and system variable path then simply press widow button the type "env" then you will see "Edit the system Environment variables" then press enter and at the last you will see "Environment variables" clik on it and you will see 2 option for variable. One for user variable and another for system variable. select "path" for both and edit.)

My answer is somehow different, although I was using Visual Studio Code, I didn't find the flutter doctor option after pressing ctrl+shift+p.
I solved this issue after finding out, that I didn't choose the trusted system of Visual Studio.

open your path /flutter/bin
then delete cache folder
open terminal
flutter doctor -v
This will fix all problem.

you can just do this>
navigate to flutter bin
cd C:\flutter\bin
C:\flutter\bin> flutter doctor

I installed fresh right now and if you run flutter doctor with console under administrator rights it works for me. If not I have the same behavior as described in your post.

For some reason the latest version that I installed did not work! Installing lower version with same configuration worked!

Related

How to use git commands in Visual Studio 2019 Integrated Terminal [duplicate]

Visual Studio Code reports "It look like git is not installed on your system." when I try to switch to the git view. I know I have git installed and used by other Git clients. I guess if I reinstall Git following Visual Studio Code's instruction ("install it with Chocolatey or download it from git-scm.com"), it probably can fix the problem, but I don't want to mess up the existing Git clients on my system. Is there a reliable way to configure Visual Studio Code so it can find existing git installation?
Now you can configure Visual Studio Code (version 0.10.2, check for older versions) to use an existing Git installation.
Just add the path to the Git executable in your Visual Studio Code settings (menu File → Preferences → Settings) like this:
{
// Is Git enabled
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\path\\to\\git.exe"
// Other settings
}
Update 2020 (Mac)
I went through this $h!† again after updating to macOS v10.15 (Catalina), which requires an Xcode update.
And to clarify, while this post is about Visual Studio Code, this issue, is system wide. Your Git install is affected/hosed. You can try to run git in your terminal, Bash, Z shell (zsh), or whatever. It is now and it just won't.
It is the same fix. Just update Xcode. Start it up and agree to the license. That's it.
I hit this on Mac/OS X.
Symptoms:
You've been using Visual Studio Code for some time and have don’t have any issues with Git
You install Xcode (for whatever reason - OS update, etc.)
After installing Xcode, Visual Studio Code suddenly "can't find Git and asks you to either install or set the Path in settings"
Quick fix:
Run Xcode (for the first time, after installing) and agree to license. That's it.
How I stumbled upon this "fix":
After going through numerous tips about checking git, e.g., which git and git --version, the latter actually offered clues with this Terminal message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
As to why Xcode would even wrap it's hands on git, WAT.
Visual Studio Code simply looks in your PATH for git. Many UI clients ship with a "Portable Git" for simplicity, and do not add git to the path.
If you add your existing git client to your PATH (so that it can find git.exe), Visual Studio Code should enable Git source control management.
This can happen after upgrading macOS. Try running Git from a terminal and see if the error message begins with:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) ...
If so, the fix is to run:
xcode-select --install
from the terminal. See this answer for more details.
I had this problem after upgrading to macOS v10.15 (Catalina).
The issue is resolved as follows:
1.
Find the Git location from the terminal:
which git
2.
Add the location of Git in settings file with your location:
settings.json
"git.path": "/usr/local/bin/git",
Depending on your platform, the user settings file (settings.json) is located here:
Windows %APPDATA%\Code\User\settings.json
macOS $HOME/Library/Application Support/Code/User/settings.json
Linux $HOME/.config/Code/User/settings.json
In Visual Studio Code, open 'User Settings': Ctrl + P and type >sett. Press Enter.
This will open the default settings on the left side and User Settings on the right side.
Just add the path to git.exe in user settings:
"git.path": "C:\\Users\\[WINDOWS_USER]\\AppData\\Local\\Programs\\Git\\bin\\git.exe"
Replace [WINDOWS_USER] with your user name.
Restart Visual Studio Code.
First check if Git* is installed or not in your system by typing the command in cmd /command prompt (in Windows):
where git
If you get an output like this,
λ where git
C:\cmder\vendor\git-for-windows\cmd\git.exe
Then Go to Settings → Preferences → Settings and put the bellow code** right part.
{
// If git enabled?
"git.enabled": true,
// Path to the Git executable
"git.path": "C:\\cmder\\vendor\\git-for-windows\\cmd\\git.exe"
}
If you don't have Git installed, install Git from https://git-scm.com/
** Just add a double slash (\\), just like the above code.
UPGRADE TO MacOS Ventura < 13.0
As of November 2022
Upgrading to MacOS Ventura does not seem to affect your coding environments too much.
After upgrading to macOS Ventura your Terminal and VScode will give off a few errors. Such as:
It look like git is not installed on your system ..
or
can't find Git and asks you to either install or set the Path in settings
some errors depend on your zsh setup or other customizations.
These common problems can be resolved by simply by reinstalling xcode command line tools and updating Homebrew - since your terminal might be affected reinstall from apples executable https://developer.apple.com/download/all/
developer.apple.com you will need to log in with your apple id.
Once installed, update Homebrew
brew upgrade
Mac M1 - M2 machines likely have some native and ARM applications so run:
arch -arm64 brew upgrade
Close all terminals and Vscode to restart!
reopen Vscode, errors should be gone.
If Vscode is still looking for Git path you will need to add it manually.
Find git location and copy from the terminal:
which git
and add the path to the git executable in your Visual Studio Code JSON settings file (File -> Preferences -> Settings) find and update the line - should look similar:
"git.path": "/usr/local/bin/git",
After an OS X update, I had to run xcode-select --install for GitLens to work.
Ran into the same problem after!
how I fixed it?
Step 1: Go to the Settings in vscode.
Step 2: Open settings.json.
Step 3: You need to find something like "git.path" in settings.json
Step 4: just add the directory path where git is installed in your system.
example : "git.path": "D:/Git/bin/git.exe"
Step 5: Restart your vscode.
Hope this helps.
Run
xcode-select --install it'll prompt you to install command line developer tools. Install the tools and installation restart your VScode.
You'll see git working once again in VScode
I ran into this problem after upgrading my macOS to Monterey.
It turned out that the xcode has been removed in the new update from my mac. Just tried the following suggested solution:
https://stackoverflow.com/a/52522566/11207358
VSCode 1.50 (Sept 2020) adds an interesting alternative with issue 85734:
Support multiple values for the git.path setting
I use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn't have it.
I use an extension to keep my settings synced up between editors, and the only issue I've encountered so far is that the git path doesn't match between any of them.
On my home machine I have it installed to C of course,
work likes to be funny and install it on A,
and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find git.
I already attempted to use an array myself just to see if it'd work:
"git.path": ["C:\\Program Files\\Git\\bin\\git.exe", "A:\\Git\\bin\\git.exe", "..\\..\\Git\\bin\\git.exe"],
But VSCode reads it as one entire value.
What I'd like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.
This is addressed with PR 85954 and commit c334da1.
with VSCode 1.60+
"git.enabled": true
git.path
I faced this problem on macOS v10.13.5 (High Sierra) after upgrading Xcode.
When I run the git command, I received the below message:
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
After running the sudo xcodebuild -license command, the below message appears:
You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode.
Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
Typing the Enter key to open the license agreements and typing the space key to review details of it, until the below message appears:
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
The final step is simply typing agree to sign with the license agreement.
After typing the git command, we can check that Visual Studio Code detected Git again.
I have recently started with Visual Studio Code. I have this issue and just writing the exact path of the Git executable solves
the issue. Here is the code:
"git.path": "C:\Program Files\Git\bin\git.exe",
If you have multiple environments. You could include Git Path in the Visual Studio Code Workspace Setting. For Windows, depending on your setting, you could hit Ctrl + P, search for "settings". Open settings.json (or menu File → Preferences → Settings). Navigate to Workspace Settings. Find "Path" and add paths to Git bin and cmd folders.
Environments can have their own paths. I discovered this when I echoed my PC %PATH% on cmd. Git bin and cmd path where available, but when I was working on my project, echoed %PATH% did not have git and cmd folder. Adding them, as shown above, solved the issue.
Extra Notes:
On cmd, you can echo "%PATH%" and see if git bin and cmd folders are included. If not, you could concatenate using SETX PATH on, for example,
SETX PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;"
This will make git available on local, root but not in some environments which comes with their own paths (SETX /M PATH "%PATH%;Path_to_Git_bin;Path_to_Gt_cmd;" would have though).
In case you have a long Path that is chopped off due to Path length (getting "Error: Truncated at X characters." message), you can increase the path length in RegEdit.
In "Search Windows", search for "regedit". Right-click to open as Administrator.
Go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
Right-click and modify. Change value data from 0 to 1
This will increase your path length. If it is already one, then I am not sure how to proceed from there :).
[9
The only way I could get to work in my Windows 8.1 is the following:
Add to system environment variables (not user variables):
c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\bin\;c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\libexec\git-core\;c:\Users\USERNAME\AppData\Local\GitHub\PortableGit_YOURVERSION\cmd\
This fixed the "it looks like git is not installed on your system" error on my Visual Studio Code.
Make sure git is enabled (File --> Preferences --> Git Enabled) as other have mentioned.
Make sure Gits installed and in the PATH (with the correct location, by default: C:\Program Files\Git\cmd) - PATH on system variables btw
Change default terminal, Powershell can be a bit funny, I recommend Git BASH but cmd is fine, this can be done by selecting the terminal dropdown and selecting 'set default shell' then creating a new terminal with the + button.
Restarting VS Code, sometimes Reboot if that fails.
Hope that helped, and last but not least, it's 'git' not 'Git'/'gat'. :)
In my case GIT was installed on my WIndows 10 OS and there was an entry in PATH variable. But VS CODE 1.52.1 still unable to detect it from terminal window but it was available in CMD console.
Problem was solved by switching terminal from PowerShell to CMD or Shell + VsCode restart.
I solved the same problem on MacOS with m1 pro processor by installing Git Lens Visual Code extension. The changed files were displayed after enabling the extension. Then I turned reloaded the VSCode and there was no changes, but once I run
git status
in terminal, it shows all the files, and all changes are tracked.
Faced this issue after updating macOS!
Installed git again using homebrew and it worked!
brew install git
FOR MAC
First, type
git
in the terminal and see what error you are getting.
Then:
If the error is related to Command Line tool!
Run:
xcode-select --install
And
Just go ahead and go through this answer, For Mac especially. Worked very easily for me.
https://apple.stackexchange.com/a/254381
Three years later, I ran into the same issue. Setting the path in user settings & PATH environment variable didn't help. I updated Visual Studio Code and that solved it.
First install Git onto your desktop, and then add the encircled extension in Visual Studio Code, as seen in the picture.
That helped me fix the same issue you have.
Open
C:\Users\nassim\AppData\Roaming\Code\User\settings.json
Comment any Git line there:
// ...
// "git-graph.integratedTerminalShell": "E:\\Apps\\Git\\bin\\bash.exe",
// "git.path": ""
//...
And add git.exe to the OS path.
Note for me: Fixing this Git error also fixed the npm error too. Since they are both defined in the path, if one fail, the remaining will fail as well.
Follow this :
1. File > Preferences > setting
2. In search type -> git path
3. Now scroll down a little > you will see "Git:path" section.
4. Click "Edit in settings.json".
5. Now just paste this path there "C:\\Program Files\\Git\\mingw64\\libexec\\git-core\\git.exe"
Restart VSCode and open new terminal in VSCode and try "git version"
In case still problem exists :
1. Inside terminal click on terminal options (1:Poweshell)
2. Select default shell
3. Select bash
open new terminal and change terminal option to 2:Bash
Again try "git version" - this should work :)
What worked for me was manually adding the path variable in my system.
I followed the instructions from Method 3 in this post:
https://appuals.com/fix-git-is-not-recognized-as-an-internal-or-external-command/
If git is missing after the OS update, in my case Big Sur, just literally: brew install git
I edited Path into System Environment and add "C:\Program Files\Git\bin" then restart Vscode. It's worked for me. I don't understand why I am using it normally then I have this problem. Maybe during the installation of something it causes that problem.
It worked for me just by installing git for windows, from this link https://git-scm.com/download/win
There was no need of setting environment variable or path.
Context:
I had installed VS Code, and github desktop, I cloned the repo using Github desktop.
When I opened repo, using VS Code, I saw this error.
I resolved by installing git for windows.

How do I completely Uninstall Flutter SDK from Windows

How do I completely uninstall Flutter SDK from Windows?
I tried to delete the Flutter Folder I had cloned from GitHub but that's not working for some reason.
You have to delete flutter extension in Android Studio if you installed it, then, check envirment variables then you removes paths if exists. Finally, kill adb.exe if it's running (this may blocks you in removing folder)
Go to C drive and delete flutter folder completely, if it shows that it Opened in some app, then just restart the device and delete the folder again, it worked for me.
If you go to the dir where you cloned dir and delete it. That should remove the command line tool.
rm -rf flutter
re-install git clone https://github.com/flutter/flutter.git -b stable
Uninstall Flutter with its uninstaller.exe.
to do that
a. Go to the installation folder of Flutter.
b. Find uninstall.exe or unins000.exe.
c. double click and run it.

Flutter - running command "flutter _____" instantly closes terminal

Dealing with some significant frustration trying to set up my environment variables just to run Flutter. in my path, I've tried many suggestions to try setting up my Path route so that the Flutter Console (or cmd) can successfully run the command "flutter doctor" just to download all the packages, etc. But the problem is as soon as I run this command, it instantly closes my terminal. There isn't anything happening, the terminal just closes. Any help would be appreciated, and I've attached my screenshots of my Path envs to maybe help out some more.
envs
I also get the same problem i.e whenever I hit the flutter doctor command; the terminal instantly closes.
Solution :
Add the following to the system variable path.
C:\Windows\System32\WindowsPowerShell\v1.0
everything will work fine
I was facing the same issue and I resolved it: the problem was PowerShell version.
I am using Windows 8 and by default it has version 4.
Flutter needs version 5.0, so I upgraded my PowerShell.
Add this to system variable PATH:
C:\Windows\System32\WindowsPowerShell\v1.0
Open cmd as admin and set variables:
setx /M FLUTTER_HOME "C:\flutter" <---- here folder where your flutter is
setx /M PATH "%FLUTTER_HOME%\bin;%PATH%"
Add PowerShell path to your PATH in environment variables if not exists.
In my case C:\Windows\System32\WindowsPowerShell\v1.0 added to the PATH
Add Only these in the path and it will surely work. ONLY FOR WINDOWS
enter image description here
Note: Flutter relies on a full installation of Android Studio to
supply its Android platform dependencies. However, you can write your
Flutter apps in a number of editors; a later step discusses that.
(https://flutter.dev/docs/get-started/install/windows)
You could try to install android studio on your machine and try again.
Download Flutter SDK again and change your Flutter SDK path and update new path in
environment variable and restart your IDE
The problem is of powershell only. In my case I mistakenly used ; at the end of path which was creating problem.
Perhaps it's like when you run a bat file and Windows closes it because there's no pause command at the end?
When I ran a bat file with the same command from sublime, i saw that it said this in sublime's output...
C:\!\flutter>flutter doctor
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
Solution: Put your folder at C:\flutter. I don't know why but it fixed this. My PATH is C:\flutter\bin. The "location of the sdk" is C:\flutter.
I have the solution
go to C:/ in windows
create a src folder
into your src folder run this
git clone -b stable https://github.com/flutter/flutter.git
setup your env variables with this path= C:/src/flutter
problem solved!
For me the problem was, that in my BIOS the Virtualization Technology.
in my case non of the answers worked even adding C:\Windows\System32\WindowsPowerShell\v1.0 didn't fix the problem.
the only solution that worked for me is running the command or terminal as an administrator

Code command terminal interface on macOS of Visual Studio Code not works after restart system

I use the command on terminal code file.txt to open file with Visual Studio Code, but when I restart the system, the command stop works. And I need open Visual Studio Code, and reconfigure path to use the code command line interface.
How I can fix this? I'm using macOS HighSierra.
After I restart the system the command apparently fade.
-bash: code: command not found
So your issue may be related to how you installed VSCode
I would run below to install the same
brew cask install visual-studio-code
If you don't want to use brew then I would download the app from below link
https://code.visualstudio.com/docs/?dv=osx
And after unzipping move it to Applications folder in finder.
There may be a possibility that MacOS Gatekeeper is interfering with the location of your app after every restart. Which means the symlink gets invalidated every restart and hence the issue
If the problem still happens after restart, you want to exclude VScode out of gatekeeper
spctl --add "/Applications/Visual Studio Code.app"
Try to repeat again what is described in official documentation.
Check whether Visual Studio Code is installed in the correct folder with the command: ls -l /usr/local/bin/code.
You can find out correct path by running the command which code or where code in bash.
If the command returns path like that: /usr/local/bin/code -> /private/var/folders/xf/vnnm636d0k92w3sc7lm95w040000gn/T/AppTranslocation/3815E4B6-43DB-0F8E-AAB9-EDE3AC7F67CC/d/Visual Studio Code.app/Contents/Resources/app/bin/code
/usr/local/bin, it means that the program was installed in a temporary folder.
The path must be: /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code.
If the program was installed in a temporary folder, this could cause this problem.
Drag Visual Studio Code.app to the Applications folder and repeat
instructions from the official documentation.
If after the above described still does not work and the program is not installed in a temporary folder, it is advisable to check bash settings in ~/.bash_profile and ~/.bash_profile.
P.S.
Also, if none of the above does not help, you can try the following: sudo ln -fs "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" "/usr/local/bin/".

The term 'node' is not recognized... In Powershell

I have been trying to resolve this issue for the whole day.
When I run node -v or npm install in cmd prompt, it works absolutely fine. But when I run the same commands in Powershell, it gives the following error:s
PS C:\Users\Anubhav.Trivedi> node -v
The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelli
ng of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:5
+ node <<<< -v
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I tried uninstalling node js and reinstalling it. Added node js path C:\Program Files (x86)\nodejs\ to enviroment variables (system variables). Restarting computer. But nothing seems to work.
Kindly let me know, what am I missing here.
These issues cannot be installed from the Package Manager console, so I had to browse lot of things to fix the issues and finally I got the solution.
Maybe we followed these scenarios
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
Old version of Node.js software
You can download the latest Node.js software here.
Update Path
After installation, automatically create nodejs folder in this path “C:\Program Files (x86)” or “C:\Program Files “.
Open Control Panel -> User Accounts -> Change my environmental variable and verify the path Variable value “C:\Program Files (x86)\nodejs” or “C:\Program Files\nodejs “.
new => user = path => value = C:\Program Files (x86)\nodejs and after apply that.
and close Editor and restart it. it will work correctly.
note :- enter your path instead of copy of this path.
As dan-gph mentioned check the Path in environment variable using script $env:path -split ';' | Select-String nodejs and once you update the Path in environment variable, make sure to restart powershell and also restart explorer.exe. This would resolve the issue.
If you still face issues, check which nodejs you have installed (32bit or 64bit). Install 32 bit only as powershell or cmd are 32bit programs
Model for VSCode editor
C:\Program Files\nodejs
C:\Program Files\nodejs\node_modules\npm\bin
Search PATH environment variable.
Add the above paths into the Environment variables (both user
variable path and system variable path).
Restart VSCode.
Open a new terminal in VSCode
run node --version output should equal v16.13.0
If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying. then try this.
Restart the IDE, If you installed NodeJs recently after opening the IDE like Visual Studio Code or any other IDE that includes the terminal you are trying.
Restart the CommandLine if you installed NodeJs after you opened the CommandLine.
I hope it will be fixed most of the time by following these simple steps.
Happy Coding!
open control panel then--
user accounts
|
user accounts
|
change my environment variables
|
new
|
(In variable name use)--Path
|
(In variable value use)C:\Program Files\nodejs
|
ok
After that just restart you terminal
chances are that you messed up with your system path, if it's the case, a very straight forward solution will be re-installing node and npm but don't forget to close and re-open powershell/cmd
Note: i thought that restarting computer has no effect on path but in an accident someone just deplug my laptop from power and after i turned it on everything was repaired and OK!
Reinstall/repair the application and close the vs code powershell
I've got the same error. Simply check below instructions. If all they are done. Just restart your computer. Then it will worked for me. I just restarted my computer.
List item
Missing Node.js software
Wrongly updated Windows environment path
Installed in the wrong path
1.find nodejs folder
go to environment variable in windows
edit path and add "find nodejs folder"
Restart computer
This issue corrected after updated my environment variable path
i just copy the path from path value in user to path value in system check image attachment.
https://i.stack.imgur.com/11uCk.png
path change image below
Go to Control Panel\System and Security\System on Windows 10.
Go to advance properties.
Advance system settings -> advance system settings -> Environment Variables Or type edit the system environment variables in the windows search.
Add "C:\Program Files\nodejs" ,"C:\Program Files\nodejs" and "C:\Program Files\nodejs\node_modules\npm\bin" to the user and system variable (path)
restart the cmd and run again.
Hope it will work.

Resources