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
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.
I have tried to install cordova in Linux several times. When installing I got a Error "java home not set" and then node related error.
Is there any step by step guide to install cordova?
HOW TO INSTALL CORDOVA
Install Java Development Kit (JDK) Eg:
yum install java-1.7.0-openjdk-devel-1.7.0.79-2.5.5.1.59.amzn1.x86_64
Download and Install Android SDK.
download the appropriate Eclipse/Android SDK package from the Android site. Extract the downloaded files to a location where you can leave them permanently.
We now need to add this location to the PATH.
On Linux -
$ export PATH=$PATH:/opt/java/adt-linux/sdk/platform-tools:/opt/java/adt-linux/sdk/tools
$ echo $PATH
On WIndows -
setx PATH "%PATH%;C:\adt-windows\sdk\tools;C:\adt- windows\sdk\platform-tools"
::Exit command prompt and reopen for setx to take effect
path
Install Android Build Tools - API 19
Install Apache Ant
On Linux
sudo yum install ant
Ant should automatically be added to the PATH.
On Windows
Download Ant from Apache Website
Since Ant is not automatically added to the PATH, run the following:
setx PATH "%PATH%;C:\apache-ant-1.9.4\bin"
::Exit command prompt and reopen for setx to take effect
path
Install Node Package Manager
On Linux
sudo yum install npm
On Windows, download the appropriate setup file from the NodeJS site and run it.
Install Cordova
npm install –g cordova
Set up Android Virtual Device
ERRORS ENCOUNTERED
JAVA_HOME Not Set
On Linux
$ alternatives --config java
Ctrl + C or Ctrl + Break [Important. Don't Press Any Other Key.]
Copy the Location under Command
eg. Location is /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64/
$ export JAVA_HOME= /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.0.fc20.x86_64/
32bit Library Missing on Linux
$ sudo yum install ia32-libs
Link NodeJS and Node Folders on Linux
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
[ ensure there are no trailing “/” (slash) after the nodejs or node ]
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.
when install PhoneGap 3.X using npm, recieve some Errors, like (image below):
note: I NodeJS already installed
Try installing older version:
npm install -g phonegap#3.4
However if you want to install latest version. Follow steps suggested in this post.
Download the zip of phonegap-cli repo (https://github.com/phonegap/phonegap-cli/archive/master.zip)
Unzip it
Open the package.json file and find the cordova-lib entry in dependencies (line 32)
Change the value to 0.21.3 which is the last version.
Recreate an archive of the folder to the tar.gz format
Open your CLI and run this command:
npm install -g path/to/archive/phonegap-cli-master.tar.gz
You can add the version number while installing. For instance:
npm install -g phonegap#3.4
Hope, this will help you.