Ionic2 RC0 & Socket.io > build error


#1

Trying to use socket.io with Ionic2. Installed socket.io via $ npm install socket.io-client --save and the typing via $ typings install dt~socket.io-client --save --global

Using ionic serve it works fine, but when trying to build for ios, I get an ngc error, saying:

[23:29:28]  ngc: Error: Error at /Users/floriannorbertbepunkt/Dropbox/Dropbox Arbeit/Mister Bishop Studios/Ionic Tests/myApp/.tmp/providers/backandService.ts:72:21: Cannot find namespace 'SocketIOClient'.
    at check (/Users/floriannorbertbepunkt/Dropbox/Dropbox Arbeit/Mister Bishop Studios/Ionic Tests/myApp/node_modules/@angular/tsc-wrapped/src/tsc.js:31:15)
    at Tsc.typeCheck (/Users/floriannorbertbepunkt/Dropbox/Dropbox Arbeit/Mister Bishop Studios/Ionic Tests/myApp/node_modules/@angular/tsc-wrapped/src/tsc.js:86:9)
    at /Users/floriannorbertbepunkt/Dropbox/Dropbox Arbeit/Mister Bishop Studios/Ionic Tests/myApp/node_modules/@angular/tsc-wrapped/src/main.js:33:23
    at process._tickCallback (internal/process/next_tick.js:103:7)
    at Function.Module.runMain (module.js:449:11)
    at startup (node.js:148:18)
    at node.js:405:3


[23:29:28]  ngc: Compilation failed

Does anyone got socket.io working with RC0 and can tell me what I’m missing here?


#2

Issue solved. If others have the same problem, please take a look here: https://github.com/backand/backand-ionic2-starter/issues/4

It seems like correct typings for socket.io were not installed. You can do this with

npm install @types/node --save-dev --save-exact
npm install @types/socket.io-client --save-dev --save-exact