Error installing from npm: socket.io-client. Unable to resolve some modules: "bufferutil" , "utf-8-validate"


#1

After installing socket.io-client (meteor npm install --save socket.io-client), on build I receive the following log:

Unable to resolve some modules:

  "bufferutil" in                             
/Users/admin/Desktop/x/node_modules/ws/lib/BufferUtil.js
(web.browser)
  "utf-8-validate" in                         
/Users/admin/Desktop/x/node_modules/ws/lib/Validation.js
(web.browser)
                                              
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save bufferutil utf-8-validate

Even after

meteor npm install --save bufferutil utf-8-validate

I get this error:

"TypeError: response.setEncoding is not a function. (In 'response.setEncoding("utf8")', 'response.setEncoding' is undefined)"

Has anyone faced the similar issue?


p.s. this is how I use socket.io -

//client.js
import io from 'socket.io-client';

    const socket = io('http://foo.com:1337/');
    socket.on('connect', (...args) => {
        console.warn('connected',...args);
    });