首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Nativescript -如何运行插件演示

Nativescript -如何运行插件演示
EN

Stack Overflow用户
提问于 2017-12-23 07:13:31
回答 2查看 324关注 0票数 0

我克隆了nativescript-google-maps sdk插件

并希望运行“demo”文件夹中的应用程序。

我该怎么做?

我进入演示文件夹并输入tns build iOS

工作得很好然后

tns run iOS

我弄错了

Could not find module 'nativescript-google-maps-sdk'

这是末尾的错误:

file:///app/main-page.js:3:25: JS ERROR Error: Could not find module 'nativescript-google-maps-sdk'. Computed path '/Users/asrock/Library/Developer/CoreSimulator/Devices/2462B1E0-F0D5-4EC5-B31B-1A5AE8CACC74/data/Containers/Bundle/Application/DD86BB36-6F11-437C-B6CA-9F936478E87D/demo.app/app/tns_modules/nativescript-google-maps-sdk'.

它似乎是在寻找/tns_modules下的google sdk,而不是/node_modules。

EN

回答 2

Stack Overflow用户

发布于 2017-12-28 04:40:31

看起来演示应用程序不知道在哪里可以找到插件。您可能需要一些类似于plugin.prepareplugin.linklink的东西,然后prepare可能会很有用,这取决于您如何设置它。不要忘记顶部的tsc会修改所有对npm run tsc的调用。另外,不要忘了用你实际的插件名称替换<<<<YOUR-PLUGIN-NAME>>>>,这个名称通常类似于nativescript-volume

代码语言:javascript
复制
// In the official plugin seed src/package.json
// https://github.com/NativeScript/nativescript-plugin-seed

"scripts": {
    "tsc": "tsc -skipLibCheck",
    "build": "npm i && tsc",
    "postclone": "npm i && node scripts/postclone.js && cd ../demo && npm i && cd ../src && npm run plugin.link",
    "test.android": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build android && tns test android --justlaunch",
    "test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo && tns build ios && tns test ios --justlaunch",
    "tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
    "plugin.link": "npm link && cd ../demo && npm link <<<<YOUR-PLUGIN-NAME>>>> && cd ../src",
    "plugin.tscwatch": "npm run tsc -- -w",
    "demo.ios": "npm i && npm run tsc && cd ../demo && tns run ios --syncAllFiles",
    "demo.android": "npm i && npm run tsc && cd ../demo && tns run android --syncAllFiles",
    "demo.reset": "cd ../demo && rimraf platforms",
    "plugin.prepare": "npm run tsc && cd ../demo && tns plugin remove <<<<YOUR-PLUGIN-NAME>>>> && tns plugin add ../src",
    "clean": "cd ../demo && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link",
    "ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'"
},
票数 0
EN

Stack Overflow用户

发布于 2018-05-20 13:53:32

代码语言:javascript
复制
npm run demo.android
npm run demo.ios

分别从src文件夹中运行带有插件的演示应用程序...

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47948366

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档