Gaurav Gupta
Gaurav Gupta

Reputation: 903

Failed to restore plugin "cordova-plugin-insomnia"

I'm trying to build my project but its fails with following error :

"Running command - failed! [ERROR] An error occurred while running cordova prepare (exit code 1):

    Discovered plugin "cordova-plugin-insomnia" in config.xml. Adding it to the project
    Failed to restore plugin "cordova-plugin-insomnia" from config.xml. You might need to try adding it again.
    Error: Failed to fetch plugin
    cordova-plugin-insomnia@git+https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git via registry.
    Probably this is either a connection problem, or plugin spec is incorrect.
    Check your connection and plugin name/version/URL.
    Error: cmd: Command failed with exit code 1 Error output:
    npm ERR! git clone
    C:\Users\<USER>\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-EddyVerbruggen-Insomnia-PhoneGap-Plugin-git-223

I tried installing cordova plugin using:

  1. $ ionic cordova plugin add cordova-plugin-insomnia $ npm install --save @ionic-native/insomnia

  2. cordova plugin add https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git

  3. npm i cordova-plugin-insomnia

but, none of the command works.

Error generated as :

npm ERR! Command failed: git -c core.longpaths=true clone C:\Users\\AppData\Roaming\npm-cache_git-remotes\git-https-github-com-EddyVerbruggen-Insomnia-PhoneGap-Plugin-git-223bcd2c C:\Users\\AppData\Local\Temp\npm-6956-d2de50d1\git-cache-d4203f45\8d2c3b01fc0c11d9bc36bc1b5f9a141bd097f908 npm ERR! Cloning into 'C:\Users\\AppData\Local\Temp\npm-6956-d2de50d1\git-cache-d4203f45\8d2c3b01fc0c11d9bc36bc1b5f9a141bd097f908'... npm ERR! git-upload-pack 'C:\Users\\AppData\Roaming\npm-cache_git-remotes\git-https-github-com-EddyVerbruggen-Insomnia-PhoneGap-Plugin-git-223bcd2c': git-upload-pack: command not found npm ERR! fatal: Could not read from remote repository. npm ERR! npm ERR! Please make sure you have the correct access rights npm ERR! and the repository exists. npm ERR! npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues npm ERR! Please include the following file with any support request: npm ERR! C:\Workspace\XXXXXX-mobile-app\node_modules\npm-debug.log will push strings array {"name":"lang","titles":["English (US)","English (UK)"],"values":["en-us","en-gb"]} android preferences file was successfully generated ios settings bundle was successfully generated

I'm using following versions -

  1. Node: v7.4.0
  2. NPM: v4.0.5
  3. Git: v1.9.5
  4. Ionic: 2

Upvotes: 2

Views: 2094

Answers (2)

Gaurav Gupta
Gaurav Gupta

Reputation: 903

Although this post has been quite old yet if anyone searching for the answer:

I did removed npm package and cordova plugin for insomnia. Then, ionic cordova prepare. Finally, again added both - package and plugin.

Don't know, what was breaking, but it worked.

Note: I was using ionic 3 at that time. New version (v5) may have package updates.

Upvotes: 0

PAD
PAD

Reputation: 2330

It's not always the solution, but in similar cases, I simply run a little npm update, and it's ok. Eventually, you should do a ionic cordova platform remove ... and then ionic cordova platform add ....

Upvotes: 0

Related Questions