Cordova 3.0.0 - How to install a plugin - plugins

I'm totally new to app development and just started to make my first steps.
I've installed Cordova and the needed utilities according this guide.
I've created my first app (using Cordova's create script) and I'm able to run it on my Nexus 4.
Now I tried to install a plugin using plugman, and I'm stuck.
This tutorial says I can install a plugin using
cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
in the application directory.
Two issues here:
1. In the application directory itself isn't a executable file named "cordova"
2. When I swtich to the cordova directory and execute the mentioned command, I get this error:
Cordova does not recognize the command plugin
Any ideas what I'm doing wrong? Or is ther a mistake in the tutorial?
Thanks a lot for any help!
EDIT:
I managed to install the plugins using plugman directly using
plugman install --platform android --project . --plugin
https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git
But nevertheless I'm still interested in how to install the plugins using cordova...

Below are several ways I've used to install plugins from Cordova CLI, hope it helps:
Firstly, make sure you've installed cordova correctly(please refer to official document if needed):
cordova -v // should print something like "3.5.0-0.2.6"
Install from Cordova plugin registry
cordova plugin add org.apache.cordova.device
This should cover most cases and here is a list of plugins available in Cordova Plugin Registry.
Install from a remote repository, typically from GitHub
cordova plugin add https://github.com/brodysoft/Cordova-SQLitePlugin
If you encountered something like "Error: Command failed: error: Failed connect to help.github.com:443; Connection refused while accessing", typically it's a proxy issue, you could retry after config your proxy:
git config --global http.proxy http://user:password#proxy:xxx
If it still not works, you could click "Dowload Zip" from github, unzip the downloaded file and then:
Install from a local directory
cordova plugin add /path/to/directory
It will look in this directory and each of its subdirectories for the plugin.

NOTE: this is related to Android platform of cordova 3.4 on my windows 8 machine (tested)
step 1=> Install plugman by command in cmd "npm install -g plugman" (note that you must have node installed)
step 2=> Download git from http://msysgit.github.com/ for windows (15 mb) install exe file
step 3=> create new variable in enviorment variable name = GIT_PATH and value= "C:\Program Files (x86)\Git (this is mine urs may be diff)", now append %GIT_PATH% in Path variable (very Important) check git command in cmd if no error than continue otherwise fix this now
step 4=> Now go to http://plugins.cordova.io/#/ find whatever plugin want to install. and get just this repository url like
step 5=> now whatever and anywhere project is, place following command in cmd
**plugman install --platform android --project F:\my17app\ --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git**
Step 7=> If it successfully install we can see in app/res/xml/config.xml file a new feature will be added with id of new plugin
PS: For environment variables see in control Panel=> System and Security => System =>Advanced System Security

I did it in this manner
D:\phonegap\hello>plugman install --platform android --project D:\phonegap\hello
\platforms\android --plugin org.apache.cordova.battery-status
where as for doing it from git
plugman install --platform android --project D:\phonegap\hello
\platforms\android --plugin https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git

Related

IONIC keeps saying the plugin is not installed

To be more specific, the plugins are: #ionic-native/estimate-beacons and #ionic-native/ibeacon. I have followed all the steps and also add the plugin into my app's module. This also happens once to my #ionic-native/ble.
Here are the console logs:
and:
Am I missing any step? I'm getting very frustrated since the project is stuck right at the beginning.
P/s: I'm using IONIC and Cordova ' newest version. I follow the docs to install the plugin:
$ ionic cordova plugin add cordova-plugin-estimote
$ npm install --save #ionic-native/estimote-beacons
then
After installing a plugin’s package, add it to your app’s NgModule.
After that, I DO see the plugin shows up in the plugins folder. All finished but everytime got asked to install the plugin!!!

ionic 2 installation requirements

Am just getting started with ionic 2 and am having problems with the installation . I want to know the requirements for installing ionic 2 apart from node and npm.
Do i need to have android sdk installed? What other stuff should I have.
You would need java sdk 1.7 or higher.
You do need to download the Android Studio and install the required android sdk version for which you would want to build.
You would also need the node version of minimum of v6.9.0 or higher.
try running node --version
And do read up on ionic appscripts in github. There are changes perhaps you would need to apply - https://github.com/driftyco/ionic-app-scripts
You could also Try installing nvm -
https://github.com/creationix/nvm
its called the node version manager. will allow you to have multiple versions of node installed and certainly recommended.
Preferably try and build on the linux platform, to avoid silly issues in windows.
Things you need for installing ionic with windows
nodejs
android sdk
java sdk.
setting path is most important
apache ant
You could check out this link for installing and running to android device
http://www.tiagoporto.com/blog/environment-setting-tutorial-ionic-android-on-windows/
to setup ionic you need to do the following
run
sudo apt-get install nodejs
sudo npm install -g cordova
then
sudo npm install -g ionic
Done run ionic serve inside app folder created using
ionic start todo super --type v2 !!
this will help you to run app on browser
now to install on device,
you need android SDK,
and then you will be able to install apk on phone.
to do that you need to setup android SDK
use the following lines to do that
Install openjdk
sudo apt-get install openjdk-7-jdk lib32stdc++6 lib32z1
Download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
install all sdk packages
cd android-sdk-linux/tools
./android update sdk --no-ui
Set android-sdk path
pico ~/.bashrc
Add these lines on top, save, and exit
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
Reload bashrc
source ~/.bashrc

How can I update to the not yet officially released Ionic 1.2?

Ionic 1.2 has been announced:
http://blog.ionic.io/announcing-ionic-1-2/
The source code is availible here:
https://github.com/driftyco/ionic/releases/tag/v1.2.0
But I haven't been able to install with with some shell commands that I have attempted:
$ bower install --save ionic#1.2.0
$ bower install https://github.com/driftyco/ionic/archive/v1.2.0.tar.gz
$ bower install driftyco/ionic-bower#v1.2.0 --force
I can download the source code but don't know how to use it to update my ionic framework
You can install it with bower using:
$ bower install ionic#1.2.0 --force
Anyway, you should take into account that this will only download libraries and source code, but not a CLI tool.
So in my opinion, if you want to test ionic 1.2, you should
Create an ionic project (as usual)
Perform bower install ionic#1.2.0 --force, in order to get the new ionic libs
Replace in your project the content of www/lib/ionic/ with the content of the recently downloaded bower_components/ionic/release/.
DETAIL: Ionic uses to include a .bowerrc file that causes bower packages to be placed in www/lib, instead of inside bower_components, so maybe you'll simply need to replace the content of www/lib/ionic/ with www/lib/ionic/release (--force is need because www/lib/ionic already exists).

Ionic framework - 'ionic' is not recognized as an internal or external command

I was trying to install ionic and create a sample project on it since morning. But, was facing a series of issues since then. Tried solving them one by one. Atlast restarted my machine and opened command prompt to build the sample project and tried
path of the sample project> ionic build android
But, i kept on facing the error that states 'ionic' is not recognized as an internal or external command.
I tried clearing the cache and reinstalling ionic in my machine. Still, I face the same issue of ionic is not recognized as an internal or external command.
Can somebody help me out on this issue?
Thanks
Manikandan J
Somehow , my npm path was not there in PATH environmental Variable
So after adding C:\Users\XXXXX\AppData\Roaming\npm to my PATH variable my problem solved :-)
Try to install the ionic framework with the -g parameter, so the installation will be globall, like this:
npm install -g ionic
-g parameter mean "its binaries end up in your PATH environment variable."
If you're on Windows 10 (and possibly Vista/8/8.1) you need to run cmd.exe as an administrator. Now when you run the commands below, your environment settings will be made.
npm install -g cordova ionic
Check if the configuration is broken or not. the update might have installed it in the wrong place.
First check: npm config get prefix
In my case It wasn't set to /usr/local but in /usr/Roaming.
So to fix it, use: npm config set prefix
Problem solved! :)
After several hours of struggle I fixed it by the below steps:
uninstall node js restart the system .
install the node js (current version).
check your node js path in System variable in an
environmental variable.
Right click the command prompt and select run as administrator. Type cd\ now get into the npm path folder by cd <YourNpmPath>\npm install -g ionic#4
That's it . Now it is globally available throughout the system.
I ran this command to uninstall:
npm uninstall -g ionic cordova
and then ran the install:
npm install -g ionic cordova
and then everything started working again.
Insert this into your system path. This happens because node modules are not seen but when you do this you make the path to the module. They are found in this location
C:\Users\[username]\AppData\Roaming\npm
Below simple steps to follow to get it working:
install Node.js
Install Ionic and cordova : npm install -g cordova ionic
create a simple project: ionic start mySimpleApp tabs
cd mySimpleApp
ionic cordova platform add android
Build the project: ionic build android
For the benefit of searchers, the other answers didn't work for me.
I deleted the 'Ionic' folder from:
C:\Users\..{me}..\AppData\Roaming\npm\node_modules
Then installed again with:
npm install -g ionic cordova
That fixed it.
I solve the problem on windows 10.The problem was that the environment variables don't contain a path to the ionic folder.
Just do:
npm config set prefix
And then
npm install -g ionic cordova
setting the path variable to C:\Users\«user name folder»\appdata\Roaming\npm helped me to resolve the issue. Please try
uninstall the old version
npm uninstall -g ionic
and try to install it again with the new version
npm install -g #ionic/cli
In my situation, I thought Ionic did not install,
but after I had changed my Windows User-Name, npm did for some reason still install on the last %AppData% folder path.
for example correct-path for new user-name is:
C:\Users\Admin\AppData\Roaming\npm
but npm did use:
C:\Users\Abc\AppData\Roaming\npm
have moved that folder contents to the right place and all just works!
But to finally fix the issue from its root cause I updated NPM settings like:
npm config -g set prefix "%AppData%\npm"
npm config -g set cache "%AppData%\npm-cache"
npm config -g get prefix
And ensured my PATH environment-variable includes the correct NPM directory.
This issue occurs when we change the path variables manually.Because of this change system doesn't find libraries for the command which needed to be executed.
While installing ionic cordova, ionic cli takes cares by adding path variable in your environment.Hope this content helps
path -
C:\user\system_name\AppData\Roaming\npm
I had the same problem on Windows, and I find solution by navigating the command prompt to
C:\Users\[username]\AppData\Roaming\npm>
Cordova, Ionic, etc. are found here.
The following steps worked for me in 2022:
Run the command prompt as Admin. This is mandatory to ensure that ionic is installed globally, otherwise you would continue to see the same error message despite installing ionic.
Type this command and hit enter: npm i -g #ionic/cli
That's it!
'ionic/java/cordova etc..' is not recognized as an internal or external command
for ionic or cordova install it from node using npm install -g ionic/cordova command.
This kind of messages comes whenever its PATH not set properly for other programs like java. System has to recognize your command available on your system or not. This can be identified only when you set your environment variable.
use this for setting your path
SET PATH = %PATH%; your app path to bin
Just follow this video, you have to set your path correctly.
http://learn.ionicframework.com/videos/windows-android/
1: Download and Install Java then open your system environment variables, and add to or create a new user variable called PATH with the full path to the bin folder of the new Java SDK installation.
2: Download Apache Ant then add the full path to the bin/ folder to the end of your PATH environment variable.
3: Add Android to PATH :Open up your environment variables setting and add the full path to both the adt-bundle/sdk/platform-tools/ folder and the adt-bundle/sdk/tools/ folder to the end of your PATH variable:
4.Install nodeJs and now you can do
npm install -g cordova ionic
I started getting this same error in the Console2 command prompt. I checked the environment variables and reinstalled ionic and cordova but this did not fixed it.
I then tried ionic in Node.js command prompt and it worked perfectly. So if you follow the other advice and it still doesn't work, try a different command prompt.
I think you should copy the bin file to the system variables and it should be fine, at least I try it on Win7 and it worked. I also got the same prob like this before.
Right click Computer, choose Properties, Advanced system settings and edit environment variables.
Try reinstalling the ionic
npm install ionic -g
uninstall ionic npm package and then clear all npm cache in appdata and then install ionic
npm install -g ionic
ionic info
you must install ionic package has global so use -g.
ionic info command is used to check the ionic information
Well, after trying several answers from many posts like this one and realizing that my environment variables were there too, I ran the
npm install -g cordova ionic
from the inside of nodejs folder in Program Files with windows prompt as administrator.
Initially I was installing it in my dev folder in D:\ partition. Hope it helps someone.
Probably you doesn't have ionic installed in your device.
First check in terminal/cmd, have you installed ionic or not?
you can check it with following command:
ionic -v
C:\Program Files\nodejs\bin
try adding this to your user and environment variables, under environment variables, and then close the command prompt window and open.
I got my problem resolved :)
npm install -g cordova ionic
and then
ionic start myApp tabs
and then
cd myApp
ionic serve
Firstly uninstall the ionic module from the project by using the following command.
npm uninstall -g ionic cordova
Then install ionic and cordova dependencies seperately as follows.
npm install -g ionic
npm install -g cordova
Please check whether ionic cli is installed or not globally and locally both
Node versions
Check if you are using the nvm,
you would have installed the ionc cli with node version 14.X, and now you might be using node 16.X or latest, this is why the ionic cli is not working in latest node version.
check list of node versions if by using nvm:
nvm list
try changing the node version to previous,
NVM user older node
change to older nvm:
nvm use 14.x.x
or your version in list

Unable to add platform ionic platform add Android

Getting below error when running command ionic platform add android
Error: ENOENT, no such file or directory _____\.cordova\lib\android\cordova\3.5.1\VERSION'
I am providing step by step installation of ionic along with cordova.
Have a look it may help you :
First install node to get started using this link
open cmd to install cordova using following command
$ sudo npm install -g cordova
(Drop sudo from the above command if running on Windows)
install ionic using command
$ sudo npm install -g ionic
Create project after selecting directory where project file will be stored,
through CMD,by following command
ionic start {project name} {template type} e.g
ionic start todo blank
Once your project is created go to your newly created project: cd .\new project. for e.g.
D:\Projects>cd.\todo
Now you have to add both android and ios to your project in order to test the build so you need to follow below commands
ionic cordova platform add android
ionic cordova platform add ios
I think in your case you are missing step 5.