无法获取已安装模块的绝对路径 [英] Failed to get absolute path to installed module

查看:323
本文介绍了无法获取已安装模块的绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我认为这与我的package.json或cordova平台的版本有关。



当我尝试运行离子状态恢复它会返回以下输出:

 试图恢复离开package.json的离子应用程序

恢复平台

cordova平台添加ios
cordova平台添加android

恢复平台完成

恢复插件

cordova插件添加cordova-plugin-whitelist
cordova插件添加cordova-plugin-console
cordova插件添加cordova-plugin-statusbar
cordova插件添加cordova-plugin-device
cordova插件添加cordova-plugin-splashscreen
cordova插件添加ionic-plugin-keyboard
cordova插件添加cordova-plugin-network-information
cordova插件添加cordova-plugin-file
cordova插件添加cordova-plugin-compat
cordova插件添加cordova-plugin-media
cordova插件a dd https://github.com/AubreyHewes/cordova-background-audio.git
遇到异常:
undefined

让我们知道吗? https://github.com/driftyco/ionic-cli/issues

而当我尝试运行失败的命令( cordova plugin add https://github.com/AubreyHewes/cordova-background-audio.git ),它会返回以下错误:

 错误:无法通过注册表获取插件git + https://github.com/AubreyHewes/cordova-background-audio.git。 
可能这是一个连接问题,或者插件规范不正确。
检查您的连接和插件名称/版本/ URL。
无法获得已安装模块的绝对路径

我不明白它为什么说是一个连接问题,因为我的网络连接工作得很好。



我的环境信息:

  Cordova CLI:7.0.0 
Ionic CLI版本:2.2.3
Ionic App Lib版本:2.2.1
ios-deploy版本:1.9.0
ios- sim版本:5.0.10
操作系统:OS X El Capitan
节点版本:v7.0.0
Xcode版本:Xcode 8.1 Build版本8B62

我正在为这个问题拉我的头发。你有什么可能导致这种情况的线索?



我的package.json内容:

  {
name:paranaiba-app,
version:1.1.1,
description:paranaiba-app:An Ionic项目,
依赖关系:{
cordova-android:^ 6.2.3,
cordova-ios:^ 4.4.0,
cordova-plugin-compat:〜1.1.0,
cordova-plugin-console:〜1.0.6,
cordova-plugin-device:〜1.1 .5,
cordova-plugin-file:〜4.3.2,
cordova-plugin-media:〜2.4.1,
cordova-plugin -music-controls:git + https://github.com/homerours/cordova-music-controls-plugin.git,
cordova-plugin-network-information:〜1.3.2 ,
cordova-plugin-splashscreen:〜4.0.2,
cordova-plugin-statusbar:〜2.2.2,
cordova-plugin-whitelist :〜1.3.2,
gulp:^ 3.5.6,
gulp-concat:^ 2.2.0,
gulp-minify-css :^ 0.3.0,
gulp-rename:^ 1.2.0,
gulp-sass:^ 2.0.4,
ionic-plugin-keyboard:〜2.2.1,
nl.kingsquare.cordova.background-audio: git + https://github.com/AubreyHewes/cordova-background-audio.git,
phonegap-plugin-push:〜1.8.4
},
devDependencies:{
bower:^ 1.3.3,
gulp-util:^ 2.2.14,
shelljs:^ 0.3.0
,cordovaPlugins:[
cordova-plugin-whitelist,
cordova-plugin-console,
cordova-plugin-statusbar ,
cordova-plugin-device,
cordova-plugin-splashscreen,
ionic-plugin-keyboard,
cordova-plugin-network-information ,
cordova-plugin-file,
cordova-plugin-compat,
cordova-plugin-media,
{
locator: https://github.com/AubreyHewes/cordova-background-audio.git,
id:nl.kingsquare.cordova.background-audio
},
{
locator:https://github.com/homerours/cordova-mu
id:cordova-plugin-music-controls
}
],
cordovaPlatforms:[
{
平台:ios,
版本:,
locator:ios
},
{
平台:android,
version:,
locator:android
}
],
cordova:{
platforms:[
android,
ios
],
插件:{
phonegap-plugin-push:{
SENDER_ID:XXXX
},
cordova-plugin-whitelist:{},
cordova-plugin-console:{},
cordova-plugin-statusbar:{},
cordova-plugin-device:{},
cordova-plugin-splashscreen:{},
ionic-plugin -keyboard:{},
cordova-plugin-network-information:{},
cordova-plugin-file:{},
cordova-plugin-compat :{},
cordova-plugin-media:{},
nl.kingsquar e.cordova.background-audio:{},
cordova-plugin-music-controls:{}
}
}
}

谢谢!

解决方案

当添加本地插件时,我收到了相同的错误消息:错误:无法获取已安装模块的绝对路径



使用选项 - nofetch (cordova@7.0.1)修正了它:

cordova plugin add ../my-plugin --nofetch



根据 https://github.com/apache/cordova-cli/blob/master/RELEASENOTES.md
使用 - nofetch 标志可以使用旧提取逻辑来获取平台和插件。


I'm with a problem that I believe that is something related to my package.json or the version of the cordova platform.

When I try to run an ionic state restore it returns the following output:

Attempting to restore your Ionic application from package.json

Restoring Platforms

cordova platform add ios
cordova platform add android

Restore platforms is complete

Restoring Plugins

cordova plugin add cordova-plugin-whitelist
cordova plugin add cordova-plugin-console
cordova plugin add cordova-plugin-statusbar
cordova plugin add cordova-plugin-device
cordova plugin add cordova-plugin-splashscreen
cordova plugin add ionic-plugin-keyboard
cordova plugin add cordova-plugin-network-information
cordova plugin add cordova-plugin-file
cordova plugin add cordova-plugin-compat
cordova plugin add cordova-plugin-media
cordova plugin add https://github.com/AubreyHewes/cordova-background-audio.git
Caught exception:
 undefined

Mind letting us know? https://github.com/driftyco/ionic-cli/issues

And when I try to run the command that failed (cordova plugin add https://github.com/AubreyHewes/cordova-background-audio.git), it returns the following error:

Error: Failed to fetch plugin git+https://github.com/AubreyHewes/cordova-background-audio.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Failed to get absolute path to installed module

I don't understand why it says that is a connection problem, because my internet connection is working just fine. Also the URL of the plugin is right too.

My environment info:

Cordova CLI: 7.0.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: OS X El Capitan
Node Version: v7.0.0
Xcode version: Xcode 8.1 Build version 8B62

I'm pulling my hairs out for this problem. Do you have a clue of what can be causing this?

My package.json content:

{
  "name": "paranaiba-app",
  "version": "1.1.1",
  "description": "paranaiba-app: An Ionic project",
  "dependencies": {
    "cordova-android": "^6.2.3",
    "cordova-ios": "^4.4.0",
    "cordova-plugin-compat": "~1.1.0",
    "cordova-plugin-console": "~1.0.6",
    "cordova-plugin-device": "~1.1.5",
    "cordova-plugin-file": "~4.3.2",
    "cordova-plugin-media": "~2.4.1",
    "cordova-plugin-music-controls": "git+https://github.com/homerours/cordova-music-controls-plugin.git",
    "cordova-plugin-network-information": "~1.3.2",
    "cordova-plugin-splashscreen": "~4.0.2",
    "cordova-plugin-statusbar": "~2.2.2",
    "cordova-plugin-whitelist": "~1.3.2",
    "gulp": "^3.5.6",
    "gulp-concat": "^2.2.0",
    "gulp-minify-css": "^0.3.0",
    "gulp-rename": "^1.2.0",
    "gulp-sass": "^2.0.4",
    "ionic-plugin-keyboard": "~2.2.1",
    "nl.kingsquare.cordova.background-audio": "git+https://github.com/AubreyHewes/cordova-background-audio.git",
    "phonegap-plugin-push": "~1.8.4"
  },
  "devDependencies": {
    "bower": "^1.3.3",
    "gulp-util": "^2.2.14",
    "shelljs": "^0.3.0"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard",
    "cordova-plugin-network-information",
    "cordova-plugin-file",
    "cordova-plugin-compat",
    "cordova-plugin-media",
    {
      "locator": "https://github.com/AubreyHewes/cordova-background-audio.git",
      "id": "nl.kingsquare.cordova.background-audio"
    },
    {
      "locator": "https://github.com/homerours/cordova-music-controls-plugin",
      "id": "cordova-plugin-music-controls"
    }
  ],
  "cordovaPlatforms": [
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    },
    {
      "platform": "android",
      "version": "",
      "locator": "android"
    }
  ],
  "cordova": {
    "platforms": [
      "android",
      "ios"
    ],
    "plugins": {
      "phonegap-plugin-push": {
        "SENDER_ID": "XXXX"
      },
      "cordova-plugin-whitelist": {},
      "cordova-plugin-console": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-file": {},
      "cordova-plugin-compat": {},
      "cordova-plugin-media": {},
      "nl.kingsquare.cordova.background-audio": {},
      "cordova-plugin-music-controls": {}
    }
  }
}

Thank you!

解决方案

I got the same error message when adding a local plugin: Error: Failed to get absolute path to installed module.

Using the option --nofetch (cordova@7.0.1) fixed it:

cordova plugin add ../my-plugin --nofetch

According to https://github.com/apache/cordova-cli/blob/master/RELEASENOTES.md : Use --nofetch flag to fetch platforms and plugins using old fetching logic.

这篇关于无法获取已安装模块的绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆