Cordova not recognized as external command inside project folder? - android

I have cordova installed in my npm folder. After cd Project_name in command line and tying cordova add platform i am getting an error
"Cordova is not recognized as internal or external command"
. I don't know what is wrong is here. I followed each step given on cordova documnentation. Below is a screenshot of the error

First check everything you have installed:
node - v
cordova -v
if these are not installed then, install it first.
Download and install NodeJS from here: https://nodejs.org/en/
Then check again node -v
If you have installed node successfully then install cordova.
npm install -g cordova
and then check cordova -v
I suggest that you will take a tour of getting started with cordova: http://cordova.apache.org/#getstarted

Try reinstalling the cordova using:
npm install -g cordova
After this you will able to add the platform.

I think you haven't set Environment Variable for the node JS.
Please follow steps which are provided in this link.

delete "platform" folder
Try add re-platform :
npm install -g cordova
or
Try reinstalling the cordova using:
npm install -g cordova

The Below steps helped me out:
Install Cordova using: npm install -g cordova
Check if Cordova is installed: To check go to "C:\Users\your username\AppData\Roaming\npm\node_modules" and search for Cordova folder. If it does not exists then in CMD run 'npm install -g cordova' to install cordova or reinstall npm and run 'npm install -g cordova'.
Environment variable PATH Exists: To check go to Environment variable (My Computer OR My PC > Right Click > Properties > Advance System Settings > Environemnts Variable button)
add
%appdata%\npm\ or c:\users\YourUserName\AppData\Roaming\npm
(replace YourUserName with the name of your user profile) to System Variable's PATH
Below are the screenshots step by step actions on Environment PATH.

Related

Ionic 3 Android build error

I am using Ionic 3. Right now I'm trying to do ionic cordova build android , but I get TypeError: env.runcmd is not a function (please see the photo attached).
I tried to:
-> ionic cordova platform rm android then ionic cordova platform add android then again build android again
-> delete node_modules folder and do npm install then build android again
But none of them helped it...
My ionic info output:
Just use command 'cordova run android' instead of 'ionic cordova run android'.
Okay, guys, the problem was exactly with cordova version. I haven't noticed when it did update to the version 7.0.1. However, I had to downgrade it to version 6.5.0 and then android build succeeded.
The only thing that confused me was the downgrade process. Every time I did sudo npm uninstall cordova -g, the cordova command was still available at bash. If I would do sudo npm install cordova#6.5.0 -g, the version still remained 7.0.1. Even some other commands such as ... --save --save-exact ... did NOT work.
So below are the steps which I've gone through to solve this issue (I am using Ubuntu linux, so this will work for linux users only).
First I uninstalled cordova through npm
sudo npm uninstall cordova -g
Then removed the program from local bin
sudo rm /usr/local/bin/cordova
Installed the specific version of cordova
sudo npm install cordova#6.5.0 -g (or whatever version you want)
And lastly, I have to admit that after cordova installation, it was now located at /usr/bin/cordova, no more at /usr/local/bin/cordova, so I had to create a hard link to it.
sudo ln -s /usr/local/bin/cordova /usr/bin/cordova
VoilĂ !

Running ionic apps in an Android Emulator.

I am new in ionic framework,and want to run the app I made into an Android emulator. I type this command,
ionic emulate android
and get this error.
Error: cmd: Command failed with exit code 1
I have all the path variables set up correctly I think.
PATH
C:\Program Files\Git\usr\local;C:\Users\W\AppData\Roaming\npm\node_modules\bower\bin;C:\Users\Theodosios\AppData\Roaming\npm;C:\Program Files (x86)\Java\jre1.8.0_111\bin
JAVA_OPTIONS
-Xmx512M
Any ideas what is wrong and how can it be fixed?
Thanks,
Theo.
Use this commands on console
npm install -g npm
npm install -g ionic cordova
npm install -g angular-cli
and setting the "Environment Variables"
JAVA_HOME
ANDROID_HOME
AVD
1) Options
Remove android platfrom and install again.
Remove platform
$ cordova platform remove android
Add Platform
$ cordova platform add android
2) Options
Open SDK manager => Run as administrator
You will require:
1) SDK Platform
2) Android SDK Platform-tools
3) Andoid SDK tools

installing ionic npm ERR! tar.unpack error

while installing ionic npm install -g ionic getting error.
Have tried : -
npm cache clean 2. run the cli by administrator 3. restarted the system but error remain same.
Badly stocked.
I was having same problem on Windows 8 (64 bit)
Solution:
Don't forget to install other dependencies before installing ionic http://ionicframework.com/docs/guide/installation.html
1) Uninstall Node from Control Panel
2) Restart PC
3) Download (MSI Installer) older version of Node from http://nodejs.org/dist/v0.10.38/ or 64bit http://nodejs.org/dist/v0.10.38/x64/
4) Install Node version 0.10.38
5) npm install -g cordova
6) npm install -g ionic
Done!
it is not nessesary to uninstall node...
just remove the old npm ionic folder
...AppData\Roaming\npm\node_modules\ionic
and try again
npm install -g ionic
For me the answers provided did not work. I got around this problem by installing cordova and ionic at the same time.
npm install -g cordova ionic
If proxy is preventing this, other things to try are setting the proxy, making http request and disabling strict-ssl. An example of setting proxy is
npm config set proxy=http://username:password#domain:port/
To make http request only change the config
npm config set registry=http://registry.npmjs.org/
To disable strict-ssl
npm config set strict-ssl=false
Also, if you wanted to view the default list of configs type
npm config ls -l
This will also show what configurations have been overridden.
Uninstall Node.js and install freshly after done installation run the following command
npm install -g ionic cordova
That's it.

Phonegap Eclipse missing cordova.jar

I followed this tutorial with the exception that I installed the current versions of the listed tools. after I installed node.js I executed npm install -g phonegap but I could not find cordova.jar.
Should I download the archive phonegap1.5 and copy the files from the downloaded folder?
Because you not in administrator mode. What you can do is
Windows
Right click the CMD and choose Run as Administrator. Then run npm install -g phonegap.
Mac
sudo npm install -g phonegap

Cordova Plugins Installation MAC

I am using Cordova 3.3.0 and I want to install the camera and network plugins. In netbeans it is very simple to do so but I can't understand how this can be accomplished on MAC. Please note that I am very new to this.
I am trying to run the following command in the terminal:
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
An error is saying
-bash: cordova: command not found
Can anyone guide me what needs to be done?
Thanks
If Cordova is well installed on your Mac, you need to add "/usr/local/share/npm/bin" directory to your $PATH variable. Open your Terminal / Command line and type:
export PATH=$PATH:/usr/local/share/npm/bin
Else, before install Cordova typing :
npm install -g cordova

Categories

Resources