我克隆了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。
答案 0 :(得分:0)
似乎演示应用程序并不知道在哪里可以找到该插件。您可能需要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/**'"
},
答案 1 :(得分:0)
npm run demo.android
npm run demo.ios
分别从src文件夹中运行带有插件的演示应用程序...