Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ionic cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git Fails #1642

Closed
AlGantori opened this issue Jun 3, 2017 · 6 comments

Comments

@AlGantori
Copy link

AlGantori commented Jun 3, 2017

I'm submitting a ... (check one with "x")
[X] bug report
[ ] feature request

Current behavior:
Steps for clipboard support in browser at https://ionicframework.com/docs/native/clipboard/ are now failing.
The command:
ionic cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git
Is now failing with Cordova 7.0.0 because the repo (VersoSolutions/CordovaClipboard) does not have a package.json
The repo VersoSolutions/CordovaClipboard does not appear active.
here are related OPEN PRs
VersoSolutions/CordovaClipboard#27
VersoSolutions/CordovaClipboard#28

Will ionic team step up and do something about this?

Thank you.

Expected behavior:
copy in Windows browser chrome/firefox works without getting "Error: cordova_not_available" alert

Steps to reproduce:
cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git --save
cordova plugin add @ionic-native/clipboard --save

package.json info:

{
  "name": "mumti",
  "author": "MUMTI Labs",
  "homepage": "http://mumti.org/",
  "private": true,
  "scripts": {
    "build": "ionic-app-scripts build",
    "clean": "ionic-app-scripts clean",
    "ionic:build": "ionic-app-scripts build  && beep ",
    "ionic:serve": "ionic-app-scripts serve && beep ",
    "lint": "ionic-app-scripts lint",
    "watch": "ionic-app-scripts watch && beep ",
    "serve:before": "watch",
    "emulate:before": "build",
    "deploy:before": "build",
    "build:before": "build",
    "run:before": "build",
    "run:after": "beep",
    "serve:after": "beep",
    "beep": "bash.exe beep.sh",
    "beep0": "bash.exe -c \"echo -en '\\a' \" ",
    "releaseAPK": "cordova build android --release -- --keystore='/S/_W/ARP/UPS.Android/SRC/LICENSES KEYSTORES/mumti.keystore' --storePassword=MumtiDu3aa1 --alias=MumtiDu3aa1  --password=MumtiDu3aa1",
    "releasePWA": "ionic cordova build browser --prod --release"
  },
  "dependencies": {
    "@angular/common": "4.1.0",
    "@angular/compiler": "4.1.0",
    "@angular/compiler-cli": "4.1.0",
    "@angular/core": "4.1.0",
    "@angular/forms": "4.1.0",
    "@angular/http": "4.1.0",
    "@angular/platform-browser": "4.1.0",
    "@angular/platform-browser-dynamic": "4.1.0",
    "@ionic-native/clipboard": "^3.9.2",
    "@ionic-native/core": "3.6.1",
    "@ionic-native/splash-screen": "3.6.1",
    "@ionic-native/status-bar": "3.6.1",
    "@ionic/storage": "2.0.1",
    "cordova-sqlite-storage": "~2.0.3",
    "ionic-angular": "3.2.0",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.10"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-cordova": "^1.3.0",
    "@ionic/cli-plugin-ionic-angular": "^1.3.0",
    "typescript": "^2.3.2"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-x-socialsharing"
  ],
  "cordovaPlatforms": [
    {
      "platform": "android",
      "version": "",
      "locator": "android"
    },
    {
      "platform": "browser",
      "version": "",
      "locator": "browser"
    }
  ],
  "description": "UPS.TS.RC6: An Ionic project",
  "config": {
    "ionic_source_map": "source-map"
  },
  "cordova": {
    "plugins": {
      "cordova-sqlite-storage": {}
    }
  }
}
 ionic info

global packages:

    @ionic/cli-utils : 1.3.0
    Cordova CLI      : 7.0.0
    Ionic CLI        : 3.3.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.3.0
    @ionic/cli-plugin-ionic-angular : 1.3.0
    Cordova Platforms               : android 6.1.2 browser 4.1.0
    Ionic Framework                 : ionic-angular 3.2.0

System:

    Node       : v7.2.0
    OS         : Windows 7
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed

@danielsogl
Copy link
Owner

@AlGantori as you can read in the given error log the package.json file is missing in the source repo:

Is now failing with Cordova 7.0.0 because the repo (VersoSolutions/CordovaClipboard) does not have a package.json

You should open a Issue there

@danielsogl
Copy link
Owner

@AlGantori You can install the plugin if you downgrade your cordova cli back to 6.5

@ihadeed
Copy link
Collaborator

ihadeed commented Jun 3, 2017

Install danielsogl-cordova-plugin-clipboard or cordova-clipboard and it should work fine.

@ihadeed ihadeed closed this as completed Jun 3, 2017
@AlGantori
Copy link
Author

@ihadeed cordova-clipboard fails here is the console log

$ cordova plugin add cordova-clipboard --save
Installing "cordova-clipboard" for android
ANDROID_HOME=C:/Users/AXM/AppData/Local/Android/android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_45
Subproject Path: CordovaLib
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'C:\Users\AXM\AppData\Local\Android\android-sdk\add-ons\addon-google_apis-google-19-1' (Expected 'C:\Users\AXM\AppData\Local\Android\android-sdk\add-ons\addon-google_apis-google-19')
Observed package id 'add-ons;addon-google_apis-google-19' in inconsistent location 'C:\Users\AXM\AppData\Local\Android\android-sdk\add-ons\addon-google_apis-google-19-1' (Expected 'C:\Users\AXM\AppData\Local\Android\android-sdk\add-ons\addon-google_apis-google-19')
Incremental java compilation is an incubating feature.
:clean
:CordovaLib:clean 
BUILD SUCCESSFUL 
Total time: 14.056 secs
Installing "cordova-clipboard" for browser
Saved plugin info for "cordova-clipboard" to config.xml
Adding cordova-clipboard to package.json
shell.js: internal error
Error: EPERM: operation not permitted, mkdir 'S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\platforms\browser\www'
at Object.fs.mkdirSync (fs.js:854:18)
at C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\mkdir.js:65:10
at Array.forEach (native)
at Object._mkdir (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\mkdir.js:48:8)
at Object.mkdir (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\common.js:186:23)
at browser_parser.update_www (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\metadata\browser_parser.js:77:11)
at PlatformApiPoly.prepare (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\platforms\PlatformApiPoly.js:202:18)
at C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:106:32
at _fulfilled (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\AXM\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)

danielsogl-cordova-plugin-clipboard installs without errors

$ cordova plugin add danielsogl-cordova-plugin-clipboard --save
Installing "com.danielsogl.cordova.clipboard" for android
Installing "com.danielsogl.cordova.clipboard" for browser
Saved plugin info for "com.danielsogl.cordova.clipboard" to config.xml
Adding com.danielsogl.cordova.clipboard to package.json

But now I get a different error on Clipboard.copy "Error: Missing Command Error"

@danielsogl I have now downgraded to [email protected] and
$ ionic cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git
seems to install OK

> cordova plugin add https://github.com/VersoSolutions/CordovaClipboard.git --save
✔ Running command - done!
Fetching plugin "https://github.com/VersoSolutions/CordovaClipboard.git" via git clone
Repository "https://github.com/VersoSolutions/CordovaClipboard.git" checked out to git ref "master".
cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\LICENSE 

cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\LICENSE
cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\plugin.xml 
cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\LICENSE
cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\plugin.xml
cp: dest file already exists: S:\_W\ARP\UPS.TS\SRC\UPS.TS.2.0\plugins\com.verso.cordova.clipboard\README.md 

skipping existing file: Clipboard.java
skipping existing file: CDVClipboard.h
skipping existing file: CDVClipboard.m
skipping existing file: Clipboard.cs
skipping existing file: clipboard.js
Installing "com.verso.cordova.clipboard" for android
Installing "com.verso.cordova.clipboard" for browser
Saved plugin info for "com.verso.cordova.clipboard" to config.xml

but again I get the same error ** "Error: Missing Command Error"**

Here is the code I try to provide when running in the browser

// , public Clipboard: Clipboard 
// was injected in the constructor

 //---------------------------------------------------------------------- 
    // http://ionicframework.com/docs/api/components/alert/AlertController/
    // http://ionicframework.com/docs/components/#alert
    // https://ionicframework.com/docs/native/clipboard/
    // 20170519
    ShareViaBrowser(message, subject, file, link) {
        let prompt = this.AlertController.create({
            title: "Share this link",
            inputs: [{
                name: 'name',
                placeholder: 'link...',
                value: link
            }],
            buttons: [
                {
                    text: 'Cancel'
                },
                {
                    text: 'Copy',
                    handler: data => {
                        console.log("SocialShare------------>>ShareViaBrowser, User accepted", data);
                        this.Clipboard.copy(data).then(
                            (resolve: string) => {
                                alert(resolve);
                            },
                            (reject: string) => {
                                alert('Error: ' + reject);
                            }
                        );
                    }
                }
            ]
        });

        prompt.present();
    }

How can I get a text copy to work in the browser?
Thank you.

@ihadeed
Copy link
Collaborator

ihadeed commented Jun 3, 2017

Did you try the other package I mentioned?

The error you're getting from installing cordova-clipboard is most likely caused by a missing Android Build tools package. It's not even a problem caused by the plugin.. the plugin has no library requirements so it shouldn't throw any errors.

I recommend you update all the Android libraries from the SDK manager, then remove the platforms/android directory and run cordova platform add android@latest

@AlGantori
Copy link
Author

AlGantori commented Jun 4, 2017

My reply above mentions both packages and their logs cordova-clipboard and danielsogl-cordova-plugin-clipboard, is that what you meant by the other package?

I will try few more things and then perform your other suggestions: the Android SDK + re-install of Cordova android platform and report.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants