错误:模板" phonegap-template-push"没找到

时间:2016-10-21 20:18:10

标签: macos cordova push-notification

我有Cordova 5.0.0和PhoneGap CLI 5.0.0-0.27.1,我在Mac OS X 10.10.5上。我一直在尝试按照http://docs.phonegap.com/develop/push-notifications/的说明操作,但每次我输入第一个命令phonegap create CLIMobile --template phonegap-template-push时,它都会向我发出错误:[error] the template "phonegap-template-push" was not found

我在家用电脑上重复了同样的步骤,即Windows 10,它工作正常。

帮助?

1 个答案:

答案 0 :(得分:2)

我找到了您最近未回答的问题,因为我正在寻找这个确切错误的解决方案。显然我们是遇到它的唯一两个人。我刚刚想出了一个解决方案,所以在这里。

首先,您需要在phonegap安装中打开package.json文件,该文件可能位于/ usr / local / lib / node_modules / phonegap /。打开它(进行编辑)后,向下滚动,直到看到模板部分。

这是PhoneGap引用它的模板列表的地方。请注意,未列出您尝试使用的模板。您需要添加它并指向PhoneGap可以找到它的位置。

以下是该部分在您完成后应该是什么样子的示例。

  "templates": {
    "blank": {
      "description": "A blank and empty PhoneGap app.",
      "url": "https://github.com/phonegap/phonegap-app-blank/archive/master.tar.gz"
    },
    "hello-world": {
      "description": "Default hello world app for PhoneGap.",
      "url": "https://github.com/phonegap/phonegap-app-hello-world/archive/master.tar.gz"
    },
    "hello-cordova": {
      "description": "Default hello world app for Cordova.",
      "url": "https://github.com/apache/cordova-app-hello-world/archive/master.tar.gz"
    },
    "jquery-mobile-starter": {
      "description": "Starter PhoneGap project using jQuery Mobile.",
      "url": "https://github.com/cfjedimaster/jQuery-Mobile-Starter/archive/master.tar.gz"
    },
    "phonegap-template-push": {
      "description": "phonegap-template-push",
      "url": "https://github.com/phonegap/phonegap-template-push/archive/master.tar.gz"
    }
  },

保存并关闭它,然后重试命令:

phonegap create myApp --template phonegap-template-push

希望你会看到这个输出:

Downloading phonegap-template-push-template library for www...
Download complete