Installing Ionic for android development gets stuck - android

When I try to run the command npm install -g cordova ionic, it gets stuck for hours.

I also faced the same problem .So, somewhere I found the below command which worked for me. npm install -g ionic cordova

Follow the below step for proceeding further
Clean the npm cache
Update npm and node version
reinstalling npm and node
I found that changing my Environment Variable TEMP to = C:\tmp worked.
use this tutorial https://docs.npmjs.com/cli/cache

Related

the development server returned response error code 500 - react native - ./configs/main

I got this error when i tried to make hello-world sample:
react-native init hello_world
cd hello_world
react-native run-android
Even when I ran:
npm install -g react-native-git-upgrade
react-native-git-upgrade
I got same error on commend line console.
I've searched and tried many solutions but it doesn't seem to work:
Example:
* upgrade react-native
* using watchman watchman watch-del-all
* remove node_modules
* clean cache npm cache cleanor npm start -- --reset-cache
Operation: Window 8
react-native-cli: 2.0.1
react-native: 0.44.2 ( tried 0.47.1 too )
Android: Simulator Nexus5X
Thank you all in advance!
Delete babel-preset-react-native folder inside node_modules and then install older version 2.1.0 of this library with npm install babel-preset-react-native#2.1.0 --save-dev.
In case if someone is using react-native: 0.57.1 or the latest one,babel-preset-react-native has been replaced by metro-react-native-babel-preset. if you still get 500 error while connecting to the device do the below step and I guess things will be fine
npm add #babel/runtime
npm install
Downgrade the following:
react-native init Project
cd Project
npm uninstall react-native
npm install --save react-native#0.55.4
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native#4.0.0
react-native run-android
For me it's about the react native version. I just install the new version of react native "0.59.2" then i downgrade to previous version to "0.55.2", and everything works fine.

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Ă !

Cordova cannot find module

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

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.

How to update phonegap to 3.4.0

I'm trying to update my version of phonegap:
C:\Users\jhutber>phonegap -v
3.3.0-0.19.6
npm update -g phonegap
//runs....
//even updating npm
npm update npm -g
C:\Users\jhutber>npm info phonegap version
3.3.0-0.19.6
So how can I update my machine to use phonegap 3.4.0?
I'm using Windows 7.
$ sudo npm update -g cordova
its the command for update your Phonegap App...
in case you need more information visit:
http://docs.phonegap.com/en/3.4.0/guide_cli_index.md.html#The%20Command-Line%20Interface
Was looking at doing similar, hit the same issues. In the end I removed phone gap using a variety of
npm uninstall -g phonegap
npm uninstall phonegap
npm un phonegap
npm rm phonegap
npm -g rm phonegap
one of them worked, all of them complained.
Then check phonegap was gone, and
npm install -g phonegap
Seemed to work now at version 3.4.0-0.19.7
As an aside, I also drew a pentagram around my desk using the blood of a recently slaughtered goat, and I'm seriously starting to think that was the clincher..
Cheers
Ant

Categories

Resources