Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: io is not defined #90

Open
Catutigernos opened this issue Oct 26, 2019 · 0 comments
Open

ReferenceError: io is not defined #90

Catutigernos opened this issue Oct 26, 2019 · 0 comments

Comments

@Catutigernos
Copy link

I check demo apps all of them is in Typescript. I am using Javascript and Vue. I generate project tns init and I load socketio module with tns plugin add. Project works fine, but when I added socketio plugin. I am getting "ReferenceError: io is not defined"

I checked previous issues and demo app. I saw same issues, but I tried everything and my problem is not solved.

Which platform(s) does your issue occur on?

  • Android
  • Android Version: 8.0.0
  • Device

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.1.2
  • Cross-platform modules:
    "nativescript": {
    "platforms": {
    "ios": "5.0.0",
    "android": "5.0.0"
    }
    },
    "version": "6.1.2"
  • Runtime(s):
    "nativescript": {
    "id": "org.nativescript.example",
    "tns-ios": {
    "version": "6.1.0"
    },
    "tns-android": {
    "version": "6.1.2"
    }
    },
  • Plugin(s):
    "dependencies": {
    "nativescript-socketio": "^3.3.1",
    "nativescript-theme-core": "~1.0.6",
    "nativescript-vue": "~2.4.0",
    "socket.io": "^2.3.0",
    "socket.io-client": "^2.3.0",
    "tns-core-modules": "~6.1.0"
    },
    "devDependencies": {
    "@babel/core": "~7.1.0",
    "@babel/preset-env": "~7.1.0",
    "babel-loader": "~8.0.0",
    "nativescript-dev-webpack": "~1.2.0",
    "nativescript-vue-template-compiler": "~2.4.0",
    "node-sass": "^4.7.1",
    "vue-loader": "~15.4.0"
    },

Please, tell us how to recreate the issue in as much detail as possible.

I generate template project with "tns init" command after that I add socketio module with "tns add plugin" command. After that, change app.js like below

import Vue from "nativescript-vue";

import Home from "./components/Home";
const SocketIO = require('nativescript-socketio').SocketIO;
const socket = new SocketIO('http://192.168.1.122:3000/', {});

new Vue({

    template: `
        <Frame>
            <Home />
        </Frame>`,

    components: {
        Home
    },    
    mounted: function() {
        socket.connect()
    }
}).$start();

If I remove socket io object from code. Code works fine, otherwise it gives "io is not defined" error. There is no any usage of socket module except app.js

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant