Nativescript-vue: Can't show alert

Created on 2 May 2019  路  3Comments  路  Source: nativescript-vue/nativescript-vue

Version

2.2.2

Reproduction link

https://github.com/Sjoerrdd/tessa-app

Platform and OS info

Latest nativescript running on iOS 12

Steps to reproduce

Create a new vue file
Paste this code (dialogs.alert() and alert() give the same error)

<template>
  <Page>
    <Label id="lbl" text="HOI" textWrap="true" />
  </Page>
</template>
<script>
import axios from 'axios';
var dialogs = require("tns-core-modules/ui/dialogs");

export default {
  mounted() {
    dialogs.alert("Your message");
  }
}
</script>

What is expected?

A popup should show up

What is actually happening?

An error:

ERROR in ../node_modules/debug/src/node.js
Module not found: Error: Can't resolve 'net' in '/Users/jackgeenen/Apps/TessaNS/node_modules/debug/src'
@ ../node_modules/debug/src/node.js 177:16-30
@ ../node_modules/debug/src/index.js
@ ../node_modules/follow-redirects/index.js
@ ../node_modules/axios/lib/adapters/http.js
@ ../node_modules/axios/lib/defaults.js
@ ../node_modules/axios/lib/axios.js
@ ../node_modules/axios/index.js
@ ../node_modules/babel-loader/lib!../node_modules/vue-loader/lib??vue-loader-options!./components/urenregistratie/Kalender.vue?vue&type=script&lang=js&
@ ./components/urenregistratie/Kalender.vue?vue&type=script&lang=js&
@ ./components/urenregistratie/Kalender.vue
@ ./main.js

normal

Most helpful comment

The issue is axios. Import it from axios/dist/axios and it should work.

All 3 comments

The issue is axios. Import it from axios/dist/axios and it should work.

Solved

We are locking this issue because it has been closed for more than 14 days.

If the issue comes up again please open a new issue with additional details.

Was this page helpful?
0 / 5 - 0 ratings