Coder Social home page Coder Social logo

Comments (15)

mosabab avatar mosabab commented on July 28, 2024 1

npm ls -g cordova-fetch

the following message appear:

/usr/local/lib
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└── [email protected] deduped

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024 1

I run the Terminal without sudo and the code work well now
Thanks for help
I will close the issue

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024

Can you please try the command with --verbose flag?

It may provide more insights by giving the actual git stdout, and I can't reproduce the issue locally.

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

Can you please try the command with --verbose flag?

It may provide more insights by giving the actual git stdout, and I can't reproduce the issue locally.

THE ERROR:

Discovered plugin "cordova-plugin-vibration". Adding it to the project
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/apache/cordova-plugin-vibration.git"
Failed to fetch plugin https://github.com/apache/cordova-plugin-vibration.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
CordovaError: Failed to fetch plugin https://github.com/apache/cordova-plugin-vibration.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43

from cordova-fetch.

dpogue avatar dpogue commented on July 28, 2024

You said the plugins are being restored from config.xml?
Cordova should be trying to automatically migrate those to package.json, which would use github:apache/cordova-plugin-vibration as the spec rather than https://github.com/apache/cordova-plugin-vibration.git.

I'd be curious to know if changing the spec in config.xml to the github:apache/cordova-plugin-vibration format fixes the problem.

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

You said the plugins are being restored from config.xml? Cordova should be trying to automatically migrate those to package.json, which would use github:apache/cordova-plugin-vibration as the spec rather than https://github.com/apache/cordova-plugin-vibration.git.

I'd be curious to know if changing the spec in config.xml to the github:apache/cordova-plugin-vibration format fixes the problem.

this what my config.xml looks like:

<plugin name="cordova-plugin-battery-status" spec="https://github.com/apache/cordova-plugin-battery-status.git" />

I will try your suggestion and I will let you know if fix the problem.
thanks

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

You said the plugins are being restored from config.xml? Cordova should be trying to automatically migrate those to package.json, which would use github:apache/cordova-plugin-vibration as the spec rather than https://github.com/apache/cordova-plugin-vibration.git.

I'd be curious to know if changing the spec in config.xml to the github:apache/cordova-plugin-vibration format fixes the problem.

I try to use github:apache/cordova-plugin-vibration in spec

also produce same error.

I build the app from scratch. using:
sudo cordova platform add ios --verbose

I put cordova-plugin-vibration as an example,
the following error occur for each plugin listed in config.xml:

Discovered plugin "cordova-plugin-vibration". Adding it to the project
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "github:apache/cordova-plugin-vibration"
Failed to fetch plugin github:apache/cordova-plugin-vibration via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
CordovaError: Failed to fetch plugin github:apache/cordova-plugin-vibration via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43

from cordova-fetch.

dpogue avatar dpogue commented on July 28, 2024

Just to rule out weird issues, can you check if a basic git clone https://github.com/apache/cordova-plugin-vibration.git works? I'm wondering if there's an issue with the system git or some kind of "trust GitHub's keys" thing causing problems here

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

git clone https://github.com/apache/cordova-plugin-vibration.git

Just to rule out weird issues, can you check if a basic git clone https://github.com/apache/cordova-plugin-vibration.git works? I'm wondering if there's an issue with the system git or some kind of "trust GitHub's keys" thing causing problems here

You mean to use git clone https://github.com/apache/cordova-plugin-vibration.git inside spec ?

from cordova-fetch.

dpogue avatar dpogue commented on July 28, 2024

No, just run that on the command-line and see if it works

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

git clone https://github.com/apache/cordova-plugin-vibration.git

in Terminal I run:
git clone https://github.com/apache/cordova-plugin-vibration.git

The following message appear:

Cloning into 'cordova-plugin-vibration'...
remote: Enumerating objects: 1615, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 1615 (delta 24), reused 39 (delta 21), pack-reused 1568
Receiving objects: 100% (1615/1615), 721.40 KiB | 2.28 MiB/s, done.
Resolving deltas: 100% (825/825), done

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024

Can you confirm what version of cordova-fetch you have?

You can find out by running npm ls -g cordova-fetch which should produce an output similar to:

$ npm ls -g cordova-fetch
/mnt/data/home/norman/.nvm/versions/node/v18.15.0/lib
└─┬ [email protected]
  ├─┬ [email protected]
  │ └── [email protected]
  └─┬ [email protected]
    └── [email protected] deduped

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024

I still cannot reproduce the problem with an app that contains the following config:

<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>HelloCordova</name>
    <description>Sample Apache Cordova App</description>
    <author email="[email protected]" href="https://cordova.apache.org">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <plugin name="cordova-plugin-vibration" spec="https://github.com/apache/cordova-plugin-vibration.git" />
</widget>

I've attempted this with both the android & ios platform on linux, as well as the ios platform on Mac OS.

I created an app. Updated config.xml to include a plugin entry, then I cordova platform add ios which works as expected.

Using cordova-fetch for cordova-ios@^6.2.0
Adding ios project...
Creating Cordova project for the iOS platform:
	Path: platforms/ios
	Package: io.cordova.hellocordova
	Name: HelloCordova
iOS project created with [email protected]
Plugin 'cordova-plugin-vibration' found in config.xml... Migrating it to package.json
Discovered plugin "cordova-plugin-vibration". Adding it to the project
Installing "cordova-plugin-vibration" for ios
Adding cordova-plugin-vibration to package.json

I am using NodeJS 18.15.0 with NPM 9.5.0.

I even tried to create a faulty setup by deleting/messing with files inside plugins/ that could trip up installing, but nothing reproduced the same error as you are receiving.

Here are some things you could try doing:

  1. Delete the following files/folders:
  • <cordova-project>/plugins folder
  • <cordova-project>/node_modules folder
  • <cordova-project>/package-lock.json file
  • <cordova-project>/platforms folder (If you have modified contents in here, they will be lost!)
  1. Run npm install
  2. Run cordova platform add ios@6

This should clear out all the "caches" inside a project and reinstall from scratch.

If that doesn't work you can make sure that all of cordova dependencies have their latest updates applies by reinstalling cordova: npm install -g cordova@11

If all that fails, are you able to provide a sample reproduction app?

from cordova-fetch.

mosabab avatar mosabab commented on July 28, 2024

Ok,
I ignore my app, and just want to test the default cordova template hello world app.

The folder of default cordova hello world app:
Untitled

default config.xml file include:
(just I put the cordova-plugin-vibration inside)

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
-->
<widget xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0"
    id="io.cordova.hellocordova"
    version="1.0.0">
    <name>HelloCordova</name>
    <description>Sample Apache Cordova App</description>
    <author email="[email protected]" href="https://cordova.apache.org">
        Apache Cordova Team
    </author>

    <plugin name="cordova-plugin-vibration" spec="https://github.com/apache/cordova-plugin-vibration.git" />

    <!-- https://s.apache.org/cdv-content-config -->
    <content src="index.html" />

    <!-- To allow connections to other resources, you must explicitly permit them using `access` tags. -->
    <!-- https://s.apache.org/cdv-network-request-access -->
    <!-- Example:
    <access origin="https://cordova.apache.org" />
    -->

    <!-- To control which URLs the WebView itself can be navigated to, use the `allow-navigation` tags. -->
    <!-- https://s.apache.org/cdv-allow-navigation -->
    <!-- Example:
    <allow-navigation href="https://cordova.apache.org/*" />
    -->

    <!-- To control which URLs the app is allowed to ask the system to open, use the `allow-intent` tags. -->
    <!-- https://s.apache.org/cdv-allow-intent -->
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
</widget>

default package.json file include:

{
  "name": "io.cordova.hellocordova",
  "displayName": "HelloCordova",
  "version": "1.0.0",
  "description": "A sample Apache Cordova application that responds to the deviceready event.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "ecosystem:cordova"
  ],
  "author": "Apache Cordova Team",
  "license": "Apache-2.0"
}

This what I run on Terminal:

Last login: Thu May  4 02:59:46 on ttys000
mosabab@Mosabs-MacBook-Pro ~ % cd desktop
mosabab@Mosabs-MacBook-Pro desktop % cd hello-app
mosabab@Mosabs-MacBook-Pro hello-app % sudo cordova platform add ios --verbose
Password:
No scripts found for hook "before_platform_add".
No version supplied. Retrieving version from config.xml...
Grabbing pinned version.
Using cordova-fetch for cordova-ios@^6.2.0
fetch: Installing cordova-ios@^6.2.0 to /Users/mosabab/Desktop/hello-app
Running command: npm install cordova-ios@^6.2.0 --save-dev
Command finished with error code 0: npm install,cordova-ios@^6.2.0,--save-dev
Removing "cordova-" prefix from cordova-ios
Adding ios project...
Loaded API for ios project /Users/mosabab/Desktop/hello-app/node_modules/cordova-ios
Creating Cordova project for the iOS platform:
	Path: platforms/ios
	Package: io.cordova.hellocordova
	Name: HelloCordova
Copying iOS template project to /Users/mosabab/Desktop/hello-app/platforms/ios
iOS project created with [email protected]
Loaded API for ios project /Users/mosabab/Desktop/hello-app/platforms/ios/cordova/Api.js
Generating platform-specific config.xml from defaults for iOS at /Users/mosabab/Desktop/hello-app/platforms/ios/HelloCordova/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  mkdir platforms/ios/www/cordova-js-src
  copy  platforms/ios/platform_www/cordova-js-src/exec.js platforms/ios/www/cordova-js-src/exec.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/platform.js platforms/ios/www/cordova-js-src/platform.js (new file)
  mkdir platforms/ios/www/cordova-js-src/plugin
  mkdir platforms/ios/www/cordova-js-src/plugin/ios
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/console.js platforms/ios/www/cordova-js-src/plugin/ios/console.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/launchscreen.js platforms/ios/www/cordova-js-src/plugin/ios/launchscreen.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/logger.js platforms/ios/www/cordova-js-src/plugin/ios/logger.js (new file)
  copy  platforms/ios/platform_www/cordova-js-src/plugin/ios/wkwebkit.js platforms/ios/www/cordova-js-src/plugin/ios/wkwebkit.js (new file)
  copy  platforms/ios/platform_www/cordova.js platforms/ios/www/cordova.js (updated file)
  copy  www/css/index.css platforms/ios/www/css/index.css (updated file)
  copy  www/index.html platforms/ios/www/index.html (updated file)
  copy  www/js/index.js platforms/ios/www/js/index.js (updated file)
Wrote out iOS Bundle Version "1.0.0" to /Users/mosabab/Desktop/hello-app/platforms/ios/HelloCordova/HelloCordova-Info.plist
Set PRODUCT_BUNDLE_IDENTIFIER to io.cordova.hellocordova.
iOS Product Name has not changed (still "HelloCordova")
This app does not have icons defined
Updating launch storyboard images at platforms/ios/HelloCordova/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
Updating Background Color color set Contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "before_prepare".
Checking for saved platforms that haven't been added to the project
Checking for saved plugins that haven't been added to the project
Plugin 'cordova-plugin-vibration' found in config.xml... Migrating it to package.json
Discovered plugin "cordova-plugin-vibration". Adding it to the project
No scripts found for hook "before_plugin_add".
Calling plugman.fetch on plugin "https://github.com/apache/cordova-plugin-vibration.git"
Failed to fetch plugin https://github.com/apache/cordova-plugin-vibration.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
CordovaError: Failed to fetch plugin https://github.com/apache/cordova-plugin-vibration.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: An unknown git error occurred
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43
mosabab@Mosabs-MacBook-Pro hello-app % 

from cordova-fetch.

breautek avatar breautek commented on July 28, 2024

Is there any particular reason you're running commands under sudo? Running cordova (or any node program) shouldn't require sudo/root user to run and doing so is dangeorus.

Running cordova under root means you're also running npm (and git) under root as well.

It was already demonstrated that running git clone ... works as expected under your own user. Does the issue reproduce if you use git clone under the root account?

sudo git clone https://github.com/apache/cordova-plugin-vibration.git

from cordova-fetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.