Cordova inAppBrowser plugin issue on windows - node.js

so I've been trying to add this plugin with command
cordova plugin add
https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git
which worked on MAC and Linux after
npm update -g cordova
but on windows I'm still getting
cannot read property 'install' of undefined
Moreover - when I'm trying to uninstall ( cordova plugin rm org.apache.cordova.inappbrowser ) then I'm getting
cannot read property 'uninstall' of undefined
Weird thing is that I have two cordova folders - one in
C:\Users\me\AppData\Roaming\npm\node_modules and the second one in
C:\Users\me\AppData\Roaming\npm\node_modules\phonegap\node_modules . Path which I added to my environmental variables is C:\Users\mati\AppData\Roaming\npm\node_modules\phonegap\node_modules\.bin

I think that this is the problem reported about a week ago as CB-6008 on the Cordova bug tracker.
It may be a symptom of having an out-of-date cordova installation still. The issue there was solved by removing and reinstalling Cordova to ensure that the latest version was in use.

Delete the content of your platforms and plugins folder. re-install your plugins and the problem should be gone. In my case the following command
phonegap local plugin add org.apache.cordova.inappbrowser
produced -> [error] Cannot read property 'install' of undefined
and the above procedure fixed it.

Have you added a platform to your cordova project (before trying to add a plugin)?
npm update -g cordova
cordova create myproject
cd myproject
cordova platform add android
cordova plugin add _
I think the undefined error means a dependency of the add plugin command is not there.

For me, the solution was to update plugman module:
npm install -g plugman

Related

could not build apk or run it on to a device

i was able to build and test apk on to my device by cordova run android,
now suddenly it got stuck could someone help me to fix this issue, i waited almost for 20 min but no changes.
This image has my ionic info and my build part
I reinstalled platform, updated android studio, npm cache clean. but nothing success full.
I think there is something wrong with the gradle, maybe it is being downloaded, which take forever..
You might wanna mannually download the gradle and specify the downloaded path in yout_app_directory/platforms/android/cordova/builders/GradleBuidler.js => maybe somewhere around line 202 var distributionUrl = 'your_gradle_path'
Follows this
cordova platform rm android
Cordova platform add android
Open emulator or connect Device to the system then
Cordova run android
This will help you .
use command 'ionic cordova run android'
or
Update node version. The version you are using is 6.11.0 but ionic is 3.5.0. so please update node version and check again
or
If you are not using ionic3, then you can downgrade your ionic version using a command 'npm install -g ionic#2.2.0'. then use 'ionic run android'

Unable to add plugins to cordova project. npm error?

I have a Cordova application and want to add a plugin to my Cordova project. It worked yesterday!
What I did:
Updated Android Studio to 3.x
Updated Cordova
If I want use the cordova add command, I get this error:
What should I do?
Hard Reset it: Try to remove that plugin you installed yesterday, maybe do a clean install of Cordova or update all dependencies and add missing through Gradle and then finally go for installing the plugins. Somehow, I feel that Cordova version or some dependency mismatch is giving birth to such problems.

Getting error while Installing Cordova plugin

I am trying to add this plugin to my app: https://www.npmjs.com/package/cordova-pdf-generator
I installed NPM as instructed in https://blog.teamtreehouse.com/install-node-js-npm-windows. Then opened command prompt window and went to my app's folder. later i ran below commands in command prompt "npm install cordova-pdf-generator".After that ran this: "cordova plugins add node_modules/cordova-pdf-generator"
While running cordova plugins add node_modules/cordova-pdf-generator i am getting cordova.js script error.Please help me!!
Thanks,
Raghu
Those instructions seem... odd. After installing npm, you should only need to make a call to:
cordova plugin add cordova-pdf-generator --save
This should install the plugin from npm to your app, and add a line to your config.xml with the plugin info.
EDIT: thinking about the npm stuff some more, it looks like the author did some weird stuff to archive it. So... here's one way to get the plugin working. You've probably already called:
npm install cordova-pdf-generator
So that means you should have a subdirectory of the current directory named node_modules. The next steps you need to take:
Create a cordova project:
cordova create MyProject
Add the plugin to the project:
cd MyProject
cordova plugins add ../node_modules/cordova-pdf-generator
The creating of the project was needed for the plugin to be added to it. That step doesn't appear to be listed in the cordova-pdf-generator project on npmjs.com.

How to completely uninstall Cordova

since I updated my mac to Sierra I noticed a strange behaviour in my cordova app: some plugins aren't working anymore, it just seems they are not copied in the ios platform even if when I add the Platform the plugins' folders are copied as usual. It just seems xcode ignore them.
I tried a few things: removing and adding again plugins, updating cordova, uninstalling and reinstalling cordova, updating platforms, trying creating a brand new app... nothing seems to fix the problem.
Searching around I found this command:
$ cordova platform update ios --save
and it worked without doing anything else.
Unfortunately I have to use this command everytime I make a change in the app and I remove and add the platform again so I guess it's a problem in my environment.
I would like to completely uninstall cordova, node.js and git and reinstall everything again. I found a few instructions like in this question for node.js How do I uninstall nodejs installed from pkg (Mac OS X)? but I don't know how to run correctly all of the commands, some of them fail.
Uninstalling cordova and reinstalling works but doesn't solve the problem.
I did it with
$ sudo npm install -g cordova
$ sudo npm uninstall -g cordova
Can someone link me where to find clear instructions step by step? I'm not that good with command line and I really want to fix this problem without formatting the whole system.
Thank you for any help!
Think I have the solution: I removed cordova,
sudo npm uninstall -g cordova
deleted the .cordova folder in my user home folder (it's a hidden folder!) and installed cordova again with
sudo npm install -g cordova
I noticed that one of my old cordova projects was working: remove platform, add platform and by default I had ios platform version 4.3.0. GOOD!
In another cordova project created after latest update it was still using ios platform 4.2.1.
In the root project folder there is the config.xml file and in this file I found this line in just the second project:
<engine name="ios" spec="~4.2.1" />
Just removed and now cordova is using by default the latest version of the ios platform.
I don't know exactly why in one project there was this line and why not in the other one... neither know if I updated the platform in one project before reinstalling cordova and after reinstalling in onther... can't remember.
I just know that now if I create a new project it's correctly using ios platform 4.3.0 and I tried to describe all my steps...
I hope it will be useful for anyone else because I was ready to format my mac to fix this :(
I don't think you really have a problem with node or npm.
It seems to me more the kind of problem that happen when you change your node version without rebuilding node_modules directory.
If you always install modules with --save modifier, try this:
rm -rf node_modules
npm install
...if not, you can make a backup of your node_modules first. But it will be useful only to inspect it to figure out what modules are missing in your 'package.json' file.

How to update sencha cordova version

Trying to build a sencha project with:
sencha app refresh
sencha app build package
It is usually built on another machine that's unavailable right now.
I can see one of the things that has changed is in cordova.js: from:
CORDOVA_JS_BUILD_LABEL = 3.3.0 to:
CORDOVA_JS_BUILD_LABEL = 3.0.0-0-ge670de9
So this newer build machine is on an outdated version of cordova it appears.
So I ran npm install cordova -g to update it.
But it builds the same. What needs updating and how do I do this?
With npm you update the cordova binaries, but not the existing Cordova projects. In order to update the iOS/Android/WP/... projects, go into your main cordova project folder (in your case, the cordova folder inside your Sencha app) and execute:
cordova platform update ios
Replace ios for the platform you want to update. If you have several target plaforms, run the command once for each one.
I would recommend you to update all the plugins after the upgrade. For that, run:
cordova plugin list
in the same folder as before, and do a
cordova plugin remove plugin_name
cordova plugin add plugin_name
for each plugin that you are currently using.

Resources