-1
我在VS 2015中創建了一個Cordova應用程序(適用於Windows)。此應用程序預計將使用插件來訪問在託管代碼(C#)中實現的功能。我已經根據預期的架構創建了一個插件。現在在Cordova項目中添加自定義本地插件時出錯
,我得到一個錯誤,同時增加插件JN使用
Config -> Plugins-> Custom -> Local ->
滿輸出Apache Cordova Tools
科爾多瓦應用程序是:
------ Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac
------ Name from source package.json: vs-tac
------ Version from source package.json: 1.0.42
------ Package already installed globally at correct version.
Installing plugin 'D:\Learning\WindowsApp\Window 10\TestPlugin\MTIFirstCalculator'
Starting launch process C:\Users\Manoj\AppData\Roaming\Microsoft\VisualStudio\MDA\vs-npm\2.14.9\node.exe "C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\pluginInstall.js" --action install --projectSourceDir "D:\Learning\WindowsApp\Window 10\FirstCordovaApp\FirstCordovaApp" --pluginName D:\Learning\WindowsApp\Window 10\TestPlugin\MTIFirstCalculator --language en-US --cliVersion "6.1.1" --npmInstallDir "C:\Users\Manoj\AppData\Roaming\npm" --loglevel warn
------ Cordova tools 6.1.1 already installed.
Each package is licensed to you by its owner. Microsoft is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may include dependencies which are governed by additional licenses. Follow the package source (feed) URL to determine any dependencies.
Executing "before_plugin_add" hook for all plugins.
No version specified, retrieving version from config.xml
No version given in config.xml, attempting to use plugin engine info
C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\q\q.js:126
throw e;
^
Error: Registry returned 404 for GET on https://registry.npmjs.org/FirstCordovaApp
at makeError (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:302:12)
at CachingRegistryClient.<anonymous> (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:280:14)
at Request._callback (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\npm-registry-client\lib\request.js:210:14)
at Request.self.callback (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:187:22)
at Request.emit (events.js:110:17)
at Request.<anonymous> (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:1044:10)
at Request.emit (events.js:107:17)
at IncomingMessage.<anonymous> (C:\Users\Manoj\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\6.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\request.js:965:12)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
Done
plugin.xml中的內容是:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="MTIFirstCalc" version="0.2.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
<name>MTIFirstCalc</name>
<description>Calculator</description>
<license>MTI</license>
<keywords></keywords>
<repo></repo>
<issue></issue>
<js-module src="www/MTIFirstCalc.js" name="MTIFirstCalc">
<clobbers target="window.MTICalculate" />
</js-module>
<!-- windows -->
<platform name="windows">
<js-module src="src/windows/MTIFirstCalcProxy.js" name="MTIFirstCalcProxy">
<merges target="" />
</js-module>
</platform>
</plugin>
可能是什麼原因?
你的插件名是什麼?你能發佈完整的錯誤信息嗎? –
插件的名稱是MTIFirstCalc。插件的Id在xml中定義爲com.MTI.MTIFirstCalc。我編輯了OP來包含來自VS2015的'Apache Cordova工具'的完整輸出。 – MKR
我剛試過你的插件ID,它可以正常工作,你可以請你發佈你的'plugin.xml'嗎? –