Closed aderbas closed 8 years ago
Once installed I checked the directory and does not implement itself.
npm install nativescript-socketio
works fine for me try reinstalling the plugin also the Cannot find module 'nativescript-socketio'
sometimes you can ignore that because i've seen it before if the emulator doesn't crash saying it cannot locate the module you can try logging the module instance console.log(SocketIO)
or console.dump(SocketIO)
you should see something like this
JS: function SocketIO(url, args, instance) {
JS: if (app.android) {
JS: if (instance) {
JS: this.socket = instance;
JS: return;
JS: }
JS: let opts = new IO.Options();
JS: Object.assign(opts, args);
JS: this.socket = IO.socket(url, opts);
JS: this.socket.connect();
JS:
JS: }
JS: }
I tried "npm install" and "tns plugin add" both commands install 'nativescript-socketio' on 'node-modules' but the folder structure are as the picture. I tried to run anyway
$ tns platform add android
-> OK
$ tns prepare android
-> app/main-page.ts(5,27): error TS2307: Cannot find module 'nativescript-socketio'.
$ tns run android
-> app/main-page.ts(5,27): error TS2307: Cannot find module 'nativescript-socketio'.
Thats odd try tns plugin add https://github.com/triniwiz/nativescript-socketio
Okay, now downloaded correctly.
// OK
var SocketIO = require('nativescript-socketio');
// Cannot find module 'nativescript-socketio'.
import SocketIO = require('nativescript-socketio');
I think it's because I'm using the typescript and the plugin has not nativescript-socketio.d.ts with implementation.
Thks.
Ok good to know still not sure why npm is giving you problems i'll add that soon
I was looking for exactly this module, I tried to use but is not working.
In my main-page.ts:
"Cannont find module 'nativescript-socketio' "