如何在流星1.3中安装Cordova插件

时间:2021-07-19 04:22:15

I am trying to install a Mapbox plugin on my meteor 1.3 Cordova app. In 1.3 the recommendation is to install with npm so I went looking for an npm package and found one mentioned on the Mapbox website.

我正在尝试在我的流星1.3 Cordova应用程序上安装一个Mapbox插件。在1.3中,我的建议是安装npm,所以我去找了一个npm包,在Mapbox网站上找到了一个。

https://www.npmjs.com/package/cordova-plugin-mapbox#3-installation

https://www.npmjs.com/package/cordova-plugin-mapbox 3-installation

The install notes give the install line:

安装说明给出了安装线:

cordova plugin add cordova-plugin-mapbox --variable ACCESS_TOKEN=your.access.token

My first attempt was to try meteor add with roughly the same syntax

我的第一个尝试是尝试用大致相同的语法来添加流星。

meteor add cordova:cordova-plugin-mapbox@https://github.com/Telerik-Verified-Plugins/Mapbox --variable ACCESS_TOKEN=your.access.token

This gave me the fairly predictable result:

这给了我一个相当可预测的结果:

--variable: unknown option.

I then tried it out without the variable flag and got:

然后我在没有变量标志的情况下尝试了一下,得到:

cordova-plugin-mapbox: Meteor requires either an exact version (e.g. cordova-plugin-mapbox@1.0.0), a Git URL with a SHA reference, or a local path.

What is the right approach to installing cordova plugins in Meteor 1.3?

在《流星1.3》中安装cordova插件的正确方法是什么?

1 个解决方案

#1


3  

It's in the NPM registry, so you only need to provide a version (as the example in your error output suggests):

它在NPM注册表中,所以您只需要提供一个版本(正如您的错误输出中的示例所示):

meteor add cordova:cordova-plugin-mapbox@1.1.2

The variable needs to be supplied in your mobile-config.js in your meteor folder

该变量需要在移动配置中提供。在你的流星文件夹里

App.configurePlugin('cordova-plugin-mapbox', { ACCESS_TOKEN: 'ABCDEF12345' });

#1


3  

It's in the NPM registry, so you only need to provide a version (as the example in your error output suggests):

它在NPM注册表中,所以您只需要提供一个版本(正如您的错误输出中的示例所示):

meteor add cordova:cordova-plugin-mapbox@1.1.2

The variable needs to be supplied in your mobile-config.js in your meteor folder

该变量需要在移动配置中提供。在你的流星文件夹里

App.configurePlugin('cordova-plugin-mapbox', { ACCESS_TOKEN: 'ABCDEF12345' });