使用nativescript-vue,升级到最新版本的nativescript后无法运行我的应用程序。
"nativescript": {
"id": "xxx",
"tns-ios": {
"version": "6.5.1"
},
"tns-android": {
"version": "6.5.1"
}
},
App.js:
import Vue from "nativescript-vue";
import App from "./components/App";
const firebase = require('nativescript-plugin-firebase')
const {LocalNotifications} = require("nativescript-local-notifications")
firebase.init({
showNotifications: true,
showNotificationsWhenInForeground: true,
onMessageReceivedCallback: (message) => {
console.log('[Firebase] onMessageReceivedCallback:', {message});
LocalNotifications.schedule(
[{
id: 1,
title: message.data.title,
body: message.data.body,
silhouetteIcon: 'res://ic_app_icon',
thumbnail: "res://icon",
forceShowWhenInForeground: true,
notificationLed: true,
channel: i18n.t('messages_about_orders')
}])
.catch(error => console.log("doSchedule error: " + error));
}
}).then(
function () {
console.log("firebase.init done");
},
function (error) {
console.log("firebase.init error: " + error);
}
);
我运行tns run android
,并在控制台中获得Webpack build done
之后,立即收到这些消息并崩溃:
nativescript-plugin-firebase: /Users/butaminas/Local Sites/getfast.co.nz-courier-app/platforms/android/.pluginfirebaseinfo not found, forcing prepare!
nativescript-plugin-firebase: running release build or change in environment detected, forcing prepare!
Cannot use import statement outside a module
这里可能是什么问题?我有另一个类似的应用程序,并且一切正常。
我知道了。这是项目根目录中的hooks
文件夹出现的问题。
我不知道为什么会这样,但是在删除了插件(没有删除hooks目录)之后,我手动删除了hooks文件夹,然后再次安装了插件-问题消失了。