This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234870 - Cordova or Git not found on Windows
Summary: Cordova or Git not found on Windows
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: Cordova (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Jan Becicka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-23 11:57 UTC by Vladimir Riha
Modified: 2016-01-18 14:39 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (43.21 KB, text/plain)
2013-08-23 12:06 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-08-23 11:57:11 UTC
When trying to create Cordova project, IDE says it cannot find cordova or git. I can't tell which is missing, but both are on PATH. My PATH is (I put newlines here after semicolon to make it more readable, in real it is 1 line string):


C:\Ruby200\bin;
C:\windows\system32;
C:\windows;C:\windows\System32\Wbem;
C:\windows\System32\WindowsPowerShell\v1.0\;
C:\Program Files\WIDCOMM\Bluetooth Software\;
C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;
C:\Program Files (x86)\Java\jdk1.7.0_03\bin;
C:\Program Files (x86)\Java\jdk1.7.0_03;
C:\Program Files\Mercurial\;
C:\Program Files\nodejs\;
C:\Program Files (x86)\Git\cmd;
C:\Users\vlriha\AppData\Roaming\npm


In command line in Windows:

$ where cordova
C:\Users\vlriha\AppData\Roaming\npm\cordova
C:\Users\vlriha\AppData\Roaming\npm\cordova.cmd

$ where git
C:\Program Files (x86)\Git\cmd\git.exe


If I run in Java App following:

Process process = Runtime.getRuntime().exec("cordova.cmd  --version"); 
=> returns "3.0.6"

Process process = Runtime.getRuntime().exec("git.exe --version"); 
=> returns "git version 1.8.3.msysgit.0"




Product Version: NetBeans IDE Dev (Build web-main-11442-on-20130823)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 1 Vladimir Riha 2013-08-23 12:06:38 UTC
Created attachment 139122 [details]
IDE log

Here's ide log that contains some error related to cordova
Comment 2 Jan Becicka 2013-08-23 12:47:21 UTC
Works for me on Windows 8
Comment 3 Vladimir Riha 2013-08-23 13:02:48 UTC
The error shows that nodejs is looking for cordova module in [netbeans]/bin/[node_modules], which it shouldn't. I've found some advises to set up env. variable NODE_PATH so that node will start looking for modules there but it didn't make any difference in my case:

$ echo %NODE_PATH%
C:\Users\vlriha\AppData\Roaming\npm\node_modules

(this is where cordova module is), when I ran node from command line and prints paths:

$ node
> require("module").globalPaths
[ 'C:\\Users\\vlriha\\AppData\\Roaming\\npm\\node_modules',
  'C:\\Users\\vlriha\\.node_modules',
  'C:\\Users\\vlriha\\.node_libraries',
  'C:\\Program Files\\lib\\node' ]
> module.paths
[ 'C:\\Users\\vlriha\\repl\\node_modules',
  'C:\\Users\\vlriha\\node_modules',
  'C:\\Users\\node_modules',
  'C:\\node_modules' ]

it shows that hte NODE_PATH is registered...
Comment 4 Vladimir Riha 2013-08-23 14:41:59 UTC
I'm really confused, I've tried the same on Windows 8 and I have the same problem. But I'm 100% sure I've tested it on Windows 7 when it was in cordova branch...
Comment 5 Vladimir Riha 2013-08-23 16:33:33 UTC
On Windows, NetBeans tries to run "cordova.cmd -v" to check if Cordova is ready. So I modified this cordova.cmd file to simply return fake version:

@echo 3.0.1

this allows me to get through the wizard step, where is being checked if Cordova is installed. After that, I revert changes in cordova.cmd and finished new project wizard. And it worked and I can even build and start it on Android device. This "workaround" works until I close IDE. So the problem is only at the beginning in checking if Cordova is installed
Comment 6 Jan Becicka 2013-08-26 07:49:21 UTC
Changeset: e06d0f7c2e5f
Author:    Jan Becicka <jbecicka@netbeans.org>
Date:      2013-08-26 09:47
Message:
Comment 7 Jan Becicka 2013-08-26 07:51:53 UTC
Finally reproduced on Windows XP and fixed (at least on my machine)
Comment 8 Vladimir Riha 2013-08-28 07:46:34 UTC
Thank you, verified

Product Version: NetBeans IDE Dev (Build 201308280001)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b55
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b40
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 9 prabin 2013-09-22 12:10:02 UTC
i also have the same problem too.i am new to it and cannot find solution.
Comment 10 Jan Becicka 2013-09-23 06:22:11 UTC
prabin, which version of the ide do you use?
Comment 11 prabin 2013-09-23 07:20:47 UTC
(In reply to Jan Becicka from comment #10)
> prabin, which version of the ide do you use?
i use netbean ide version 7.4 rc1
Comment 12 Jan Becicka 2013-09-23 07:27:15 UTC
please go to terminal and run
git --version
cordova --version

what is the output of those commands?
Comment 13 prabin 2013-09-23 09:32:55 UTC
(In reply to Jan Becicka from comment #12)
> please go to terminal and run
> git --version
> cordova --version
> 
> what is the output of those commands?
cordova --version gives output 3.0.9
and git --version gives 'git is not recognized as external or internal command'
I have installed git 1.8.4, do i have to to setup path for it in windows environment variable?
Comment 14 prabin 2013-09-23 09:39:45 UTC
(In reply to prabin from comment #13)
> (In reply to Jan Becicka from comment #12)
> > please go to terminal and run
> > git --version
> > cordova --version
> > 
> > what is the output of those commands?
> cordova --version gives output 3.0.9
> and git --version gives 'git is not recognized as external or internal
> command'
> I have installed git 1.8.4, do i have to to setup path for it in windows
> environment variable?


again, in a git bash i tried command git --version:
it gives output: git version 1.8.4.mysysgit.0
Comment 15 Jan Becicka 2013-09-23 12:41:04 UTC
> > I have installed git 1.8.4, do i have to to setup path for it in windows
> > environment variable?

Yes. Exactly.
Comment 16 prabin 2013-09-25 08:37:08 UTC
(In reply to Jan Becicka from comment #15)
> > > I have installed git 1.8.4, do i have to to setup path for it in windows
> > > environment variable?
> 
> Yes. Exactly.

Its working.Thanks for a help.
Comment 17 onfire4g05 2013-10-04 16:45:02 UTC
I'm on 7.4RC2 and Windows 8 and still am getting the error.

C:\Users\justin> cordova -v
3.1.0-0.1.0

C:\Users\justin> git --version
git version 1.8.4.msysgit.0

Here's my PATH:

%SystemRoot%\system32;
%SystemRoot%;
%SystemRoot%\System32\Wbem;
C:\Program Files\TortoiseGit\bin;
C:\Program Files\nodejs\;
C:\Users\justin\AppData\Roaming\npm;
C:\Program Files (x86)\Git\cmd

C:\Users\justin> where git
C:\Program Files (x86)\Git\cmd\git.exe
C:\Users\justin> where cordova.cmd
C:\Users\justin\AppData\Roaming\npm\cordova.cmd

I've tried the hack that Vladimir suggested (adding @echo 3.0.1 into cordova.cmd), but that didn't work.



Product Version: NetBeans IDE 7.4 RC2 (Build 201309252201)
Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56
Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\justin\AppData\Roaming\NetBeans\7.4rc2
Cache directory: C:\Users\justin\AppData\Local\NetBeans\Cache\7.4rc2
Comment 18 Jan Becicka 2013-10-04 17:11:48 UTC
onfire4g05, your problem is reported as issue 236730
Comment 19 TAFKAMS 2013-10-22 15:18:23 UTC
I had the same problem. After upgrading git from 1.7.x to 1.8.4 it works on my machine.
Comment 20 Ovayo 2014-01-29 11:25:02 UTC
I have Netbeans 7.4. + git version 1.8.5.2. + Cordova 3.3.0
Netbeans still cannot find path to both git and cordova. Please help?
Comment 21 Marcoevich 2014-01-29 12:21:23 UTC
Do the commands cordova -v and git --version return results for you?

Also please check if you have the following locations in your path:

For Cordova:

C:\Users\<Your Name>\AppData\Roaming\npm

For git:

C:\Program Files (x86)\Git\cmd

C:\Program Files (x86)\Git\bin

Make sure that you check if the paths are correct.

You can also try to reinstall Git entirely. When installing, make sure that you select to run Git from the command line in this step: http://uncod.in/images/msysgit6.png
Comment 22 Ovayo 2014-01-29 15:12:26 UTC
Sure Thanks Marcoevich I had to do a couple more other steps though. I had to install node under xampp/htdocs plus the express modules http://www.youtube.com/watch?v=Q0HFBy2BtfA
Comment 23 Marcoevich 2014-01-29 15:30:23 UTC
Hi Ovayo,

I'm glad you where able to solve it.

I just want to note that normally you won't have to install node js or node packages directly into htdocs. If you have this line in your path:

C:\Users\<Your Name>\AppData\Roaming\npm

Then you can just install using 'npm install -g cordova' and 'npm install -g express'.

This will give you acess to those packages wherever your project resides, and not just in that specific folder.
Comment 24 Ovayo 2014-01-29 15:41:02 UTC
Great staff. Thanks
Comment 25 Ovayo 2014-01-30 07:07:15 UTC
Can I start over again rather, so I can get acess to those packages wherever my project resides, and not just in that specific folder?
Comment 26 Marcoevich 2014-01-30 10:11:34 UTC
Yes you can.

First remove Cordova and express with 'npm uninstall cordova' and 'npm uninstall express'.

Then remove NodeJS.


Secondly, install NodeJS again in it's standard location. Leave all settings as they are.

Then, install Cordova. Do 'npm install -g cordova' (watch the -g!).

Secondly, do 'npm install -g express'.

Then, check your paths! Remove all instances that point to the previous location of Node and npm.

Then, make sure your NEW NodeJS installation is available on your path:

C:\Program Files\nodejs\

Secondly, make sure your NEW npm location is available on your path:

C:\Users\<Your Name>\AppData\Roaming\npm

Lastly, please try if you've done everything correctly. Open a new (!) commandline window, type "node", hit enter. Type "npm", hit enter. Type "cordova" and hit enter. (all without quotes ofcourse)

If they all return results, you've installed it correctly.

Good luck!
Comment 27 Jan Becicka 2014-02-13 10:41:11 UTC
just add all those tools properly on your PATH. Thanks
Comment 28 illank86 2014-02-19 04:44:38 UTC
I have the same problem... all PATH have been set, but still no luck

Git Version : 1.9.0 msysgit.0

Cordova : 3.3.1-0.4.2

what should i do now? please help


Product Version: NetBeans IDE 7.4 (Build 201310111528)
Updates: NetBeans IDE is updated to version NetBeans 7.4 Patch 2
Java: 1.7.0_21; Java HotSpot(TM) Client VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
User directory: C:\Users\Nur Ilham\AppData\Roaming\NetBeans\7.4
Cache directory: C:\Users\Nur Ilham\AppData\Local\NetBeans\Cache\7.4
Comment 29 illank86 2014-02-19 08:00:57 UTC
Solved, thanks everyone
Comment 30 Ovayo 2014-02-19 09:37:46 UTC
This is the results I get:
 
ReferenceError: node is not defined

ReferenceError: cordova is not defined

Is this correct?
Comment 31 jorgemejia182 2014-07-11 15:25:08 UTC
well i had the same problem and i resolved it.

You have to install git, when you are installing git you have to change the PATH enviroment
choose the option *Use Git and optional Unix tools from the windows Command Prompt.

It results for me.

http://www.youtube.com/watch?v=tlntE8fe6u4
Comment 32 femijoy 2016-01-18 14:38:29 UTC
i am facing the same issue, it shows cordova or git not in PATH. i have provided both to my PATH.



$ git --version
git version 2.5.3.windows.1


$ cordova --version
5.1.1


$ node --version
v5.4.1


$ where git
F:\Program Files\Git\bin\git.exe
F:\Program Files\Git\mingw64\bin\git.exe


$ where cordova
C:\Users\eby\AppData\Roaming\npm\cordova
C:\Users\eby\AppData\Roaming\npm\cordova.cmd


$ where node
F:\Program Files\nodejs\node.exe


$
Comment 33 femijoy 2016-01-18 14:39:09 UTC
i am facing the same issue, it shows cordova or git not in PATH. i have provided both to my PATH.



$ git --version
git version 2.5.3.windows.1


$ cordova --version
5.1.1


$ node --version
v5.4.1


$ where git
F:\Program Files\Git\bin\git.exe
F:\Program Files\Git\mingw64\bin\git.exe


$ where cordova
C:\Users\eby\AppData\Roaming\npm\cordova
C:\Users\eby\AppData\Roaming\npm\cordova.cmd


$ where node
F:\Program Files\nodejs\node.exe


$