无法使用URL构建插件

时间:2018-10-22 14:04:43

标签: git cordova ionic-framework npm

解密: 安装最新版本的 cordova-plugin-background-mode 头版后,Android构建失败。但是,如果我在不先删除node_modules,平台和插件的情况下运行build命令,则构建工作正常。

在config.xml中:<plugin name="cordova-plugin-background-mode" spec="https://github.com/katzer/cordova-plugin-background-mode.git" />

在package.json中:"dependencies": { "cordova-plugin-background-mode": "git+https://github.com/katzer/cordova-plugin-background-mode.git" }

在package-lock.json中:"cordova-plugin-background-mode": { "version": "git+https://github.com/katzer/cordova-plugin-background-mode.git#a2352f5d8b17de5799b35177d9c7c4f32f66c49e"

复制步骤:

  1. cordova插件添加https://github.com/katzer/cordova-plugin-background-mode.git
  2. 删除node_modules,平台和插件(就像我要模拟全新还原一样)
  3. ionic cordova构建android

输出:

Looks like a fresh checkout! No ./node_modules directory found. Would you like to install project dependencies? Yes
Installing dependencies may take several minutes!
> npm i
× Running command - failed!
[ERROR] An error occurred while running npm i (exit code 1):

        npm ERR! code 128
        npm ERR! Command failed: C:\Program Files\Git\cmd\git.EXE submodule update -q --init --recursive
        npm ERR! fatal: 'submodule' appears to be a git command, but we were not
        npm ERR! able to execute it. Maybe git-submodule is broken?
        npm ERR!

离子信息: cli软件包:(C:\ Users \ a \ AppData \ Roaming \ npm \ node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

全局软件包:

cordova (Cordova CLI) : 8.0.0
Gulp CLI              : CLI version 3.9.1 Local version 3.9.1

本地软件包:

@ionic/app-scripts : 3.1.10
Cordova Platforms  : android 7.0.0
Ionic Framework    : ionic-angular 3.9.2

系统:

Android SDK Tools : 26.1.1
Node              : v8.11.3
npm               : 5.6.0
OS                : Windows 10

1 个答案:

答案 0 :(得分:0)

看看这个npm问题:

https://github.com/npm/npm/issues/20815