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
Related
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Ă !
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.
How do I add the plugin CorHttpd in my cordova project?
What is the command ?
https://github.com/floatinghotpot/cordova-httpd in this link, they says:
How to use CorHttpd:
Add the plugin to your cordova project:
I tried:
cordova plugin add https://github.com/floatinghotpot/cordova-httpd.git
but this command is not working. After I run this command I got this message:
Error: Failed to fetch plugin
https://github.com/floatinghotpot/cordova-httpd.gi t via git. Either
there is a connection problems, or plugin spec is incorrect:
Error: "git" command line tool is not installed: make sure it is accessi ble on your PATH.
Need help about this matter.
If repo name does not match with plugin id Cordova will try to serarch it via registry. Tested with Cordova 8.1.2
You need to add all git sub-packages. Please run:
sudo apt-get install git-all
And then install your plugin:
cordova plugin add https://github.com/floatinghotpot/cordova-httpd.git
You have to install git:
On windows: (git command have to be in your PATH environment variable)
Download here
On linux / mac:
sudo apt-get install git-all
I allready searched for solutions but couldn't find anything that works.
I'm trying to build / run apk with cordova but the emulator (and also my phone) won't start the app and fail on installation.
I tried to re-create the projet and re-install cordova but have this issue :
Error: Cannot find module
'C:\Users\...\AppData\Roaming\npm\node_modules\cordova\bin\cordova'
I also tried to do :
npm cache clean
Nothing is working, can someone help me please ?
Thank you !
I encountered the similar situation, here is the error information:
module.js:471
throw err;
^
Error: Cannot find module 'C:\Users\MYUSERNAME\AppData\Roaming\npm\node_modules\cordova\bin\cordova'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:504:3
It happened after I upgraded my cordova with the command:
npm install cordova -g
Even when I ran the "cordova" command solely, same error I could get.
Finally solved by reinstall the cordova completely :
npm uninstall cordova -g
then
npm install cordova -g
In my case solved by removing and adding platform android again
cordova platform rm android
cordova platform add android
I know, this question is kinda old but I got the same problem and I "by-pass" it with this method.
(SOLVED) Error: Cannot find module 'C:...\node_modules\cordova\bin\cordova' #3301
Actually, using ionic (Ionic CLI) : 3.20.0
first of all, check the JRE installation on your computer, if is ok, follow this steps
ionic serve
cordova clean android (or IOS)
rm -rf node_modules (just delete node_modules folder)
npm install
cordova build android (without ionic)
It will add plugins to your project and also will compile it to an APK.
EDIT:
Just create another project, copy the "src" folder to the new one and ready to go!
You just need to run these commands
npm uninstall -g cordova
npm install -g cordova#latest
Above commands are already answered but removing android and adding it again is important
and then these :
cordova platform rm android/ios/browser
cordova platform add android/ios/browser
Worked for me, hope it help others.
Follow these Steps:
npm uninstall -g cordova
npm install -g cordova#latest
I have a weird problem in my Ubuntu 14.04.
I was developing a mobile application using Ionic with an API using Django-Rest-Framework. After developing, I downloaded jdk and Android SDK so that I can build the mobile app into APK. I also downloaded the android dependencies or tools needed for building. After I downloaded it all, I go to my mobile app folder and type ionic platform add android to build it. But the terminal response with "No command 'ionic' found". Even typing ionic serve responses the same. I also tried to activate the virtual environment of the API using workon mobile but it responses with workon: command not found. Does anybody have an idea what might be wrong? Thanks
First Check ionic is install or not by using following command
ionic -v
It shows version if it nothing to show then install ionic by using following command
sudo npm install -g ionic
else update ionic by the following command on your terminal
sudo npm update -g
And also if you have not got the result then create symbolic link by using following command
sudo ln -s /usr/bin/nodejs /usr/bin/node
Hope this will help you !!
First install using this two line..
npm install -g cordova ionic
ioniv -v && cordova -v
and then use this line
$ ionic start myapp [template]
$ cd MyIonic2Project/
$ ionic serve