triniwiz / nativescript-socketio

Socket.IO for nativescript
Apache License 2.0
71 stars 31 forks source link

Cannot find namespace 'io' #59

Closed BlackCat1606 closed 6 years ago

BlackCat1606 commented 6 years ago

Hi , i was trying out the demo-ng and i've got this error while executing : tns run android .

node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'

can you help please

BlackCat1606 commented 6 years ago

i just solved the issue by changing the type of the variable socket which was io.socket.client.Socket to any in the file socketio.android.d.ts which solved the problem for me .

IdanDavidi commented 6 years ago

I face this issue as well

BlackCat1606 commented 6 years ago

@IdanDavidi did you solve it ?

IdanDavidi commented 6 years ago

@BlackCat1606 Your suggestion works but this is not a solution, this is not reasonable to change the socketio.android.d.ts file under node_modules.

I suspect it has something to do with the typescript version. I am using 2.7.2, what is your version?

BlackCat1606 commented 6 years ago

2.6.2 , it didn't seem reasonable also to me , i tried other typescript versions but still the same problem

IdanDavidi commented 6 years ago

@BlackCat1606 maybe you should reopen the issue

BlackCat1606 commented 6 years ago

@IdanDavidi , i will reopen it

dalsscarlon commented 6 years ago

I have the same issue.

kefahB commented 6 years ago

Hi,

if declared socketio: any (by @BlackCat1606) dont work; your must do the following, normally it will work

tns platform remove android
tns platform add android
BlackCat1606 commented 6 years ago

@kefahB , well it worked for me , but unless we got a response from the repo owner , we still don't have a clue about the solution , so please @triniwiz be more active and answer this issue

kefahB commented 6 years ago

@BlackCat1606 if you see this PR the type of socket is any and it was modified...

It work now, you can continue working until we have the return of @triniwiz ;-)

jogboms commented 6 years ago

@triniwiz 🤠

luisalcarasr commented 6 years ago

I have the same issue!

abalad commented 6 years ago

same here

node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
node_modules/nativescript-socketio/socketio.android.d.ts(3,23): error TS2503: Cannot find namespace 'io'.
mnkeis commented 6 years ago

Same issue, @BlackCat1606 workaround worked for me.

grendizeras commented 6 years ago

Same issue here. It seems that it can't detect types that are in typings folder. Any solution?

BlackCat1606 commented 6 years ago

@grendizeras did you try the work around that i talked about earlier in this issue ?

grendizeras commented 6 years ago

@BlackCat1606 Yes I did, but it is temporary solution. Thanks BTW.

triniwiz commented 6 years ago

Hi everyone can you paste your tns android version thanks

kefahB commented 6 years ago

@triniwiz Thanks for your for reply

"tns-android": {
    "version": "4.1.3"
}
grendizeras commented 6 years ago

"tns-android": { "version": "4.1.3" }

"typescript": "~2.7.2",

mnkeis commented 6 years ago

Here "tns-android": { "version": "4.1.3" }

triniwiz commented 6 years ago

Looks like everyone is on v4 so all that’s needs to be done is update the include.gradle

kefahB commented 6 years ago

I have no include.gradle file in projet_name/platforms/android/

triniwiz commented 6 years ago

@kefahB it’s in the node_modules/pluginname

kefahB commented 6 years ago

@triniwiz There is no include.gradle also ! can you explain for us what we must do in details please :-)

mnkeis commented 6 years ago

I've found an include.gradle in node_modules/nativescript-socketio/platforms/android but no clue how to update it. Follow file content

//

android {

}

dependencies { compile('io.socket:socket.io-client:0.8.2') { exclude group: 'org.json', module: 'json' } }