我克隆了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。
发布于 2017-12-28 04:40:31
看起来演示应用程序不知道在哪里可以找到插件。您可能需要一些类似于plugin.prepare或plugin.link或link的东西,然后prepare可能会很有用,这取决于您如何设置它。不要忘记顶部的tsc会修改所有对npm run tsc的调用。另外,不要忘了用你实际的插件名称替换<<<<YOUR-PLUGIN-NAME>>>>,这个名称通常类似于nativescript-volume。
// 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/**'"
},发布于 2018-05-20 13:53:32
npm run demo.android
npm run demo.ios分别从src文件夹中运行带有插件的演示应用程序...
https://stackoverflow.com/questions/47948366
复制相似问题