Cordova is not recognized... immediately after installation
Asked Answered
C

5

6

I'm stuck with this very frustrating problem while trying to install Apache Cordova. I issue npm install -g cordova in my cmd (Windows 8.1, 64 bits), and everything seems to be fine. But even after the installation when trying to type cordova it is not recognized as a command by the cmd. This is my first question on StackOverflow, so I may have missed something crucial or made a noob mistake. I hope someone out there can help me! :)

Cheers,

cmd session:

C:\Users\James>npm install -g cordova
npm http GET https://registry.npmjs.org/cordova

... bunch of text here ...

C:\Users\James\AppData\Roaming\npm\cordova -> C:\Users\James\AppData\Roaming\npm
\node_modules\cordova\bin\cordova
[email protected] C:\Users\James\AppData\Roaming\npm\node_modules\cordova
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], win
[email protected])
├── [email protected] ([email protected], [email protected], [email protected]
.0, [email protected], [email protected], [email protected], [email protected], node-uuid@
1.4.1, [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected],
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected].
0)
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected].
2, [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], undersco
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], x
[email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected],
[email protected])

C:\Users\James>cordova
'cordova' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\James>cordova
'cordova' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\James>
Covarrubias answered 27/12, 2013 at 14:20 Comment(0)
J
8

It's likely that C:\Users\James\AppData\Roaming\npm\ isn't in your path so even though cordova is installed globally (as npm defines it) it isn't working as expected.

Use the SET command to check the value for your NODE_PATH or PATH. If the npm directory tree isn't listed...that's a problem, but easily fixed.

If you don't want npm to save to this directory, check the npm configuration options and the npm folders docs to see what you can change in this regard...

Jeaninejeanlouis answered 27/12, 2013 at 14:41 Comment(0)
O
5

I just had this issue after a "successful" install, and found the cordova files under a folder called node modules in my users folder. I added c:\users\dewd\node_modules\cordova\bin to my path, restarted a cmd prompt and then cordova ran ok.

They don't like to make it easy do they!!

Okapi answered 4/3, 2014 at 15:21 Comment(0)
M
4

Add this to your PATH

C:\Users\<USERNAME>\AppData\Roaming\npm\node_modules\cordova\bin

By default the folder

C:\Users\<USERNAME>\AppData 

is not visible. configure your explorer to see it or navigate through the CLI

Manado answered 12/3, 2015 at 20:43 Comment(0)
I
2

if there still is not working check the PATH.

make sure the order is node; npm; cordova

example of the PATH

%JAVA_HOME%\bin;
%ANT_HOME%\bin;
%NODEJS%;
%NPM%;
C:\Program Files (x86)\WinAnt\bin;
C:\Program Files (x86)\Git\bin;
C:\Program Files (x86)\Git\cmd;
%CORDOVA%

To be very clean, create a new system variables NODEJS NPM CORDOVA

NODEJS="C:\Program Files\Nodejs"

NPM'="%appdata%\npm\;%USERPROFILE%\AppData\Roaming\npm;"

CORDOVA="%USERPROFILE%\AppData\Roaming\npm\node_modules\cordova\bin"

Then edit the PATH in system variables and add %NODEJS% in front of anything that uses nodejs after add %NPM% and %CORDOVA% at the end.

Interjoin answered 28/4, 2015 at 16:17 Comment(0)
G
1

this has been answered several times here...I will post my answer nonetheless.

In your prompt/terminal type this:npm config set prefix . Hope it helps ☺☺☺

Grimalkin answered 3/12, 2016 at 15:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.