kube-watch icon indicating copy to clipboard operation
kube-watch copied to clipboard

installation instructions are not working

Open dcolens opened this issue 8 years ago • 3 comments

  1. npm i kube-watch
  2. copy
import KubeWatch from 'kube-watch';

const pods = new KubeWatch('pods', {
  url: 'http://kube-api-server'   // Kubernetes API URL
});

pods
  .on('added', event => {
    console.log('Pod %s added to namespace %s with IP address %s',
      event.metadata.name, event.metadata.namespace, event.status.podIP);
  })
  .on('modified', event => {
    // do something...
  })
  .on('deleted', event => {
    // ..do something else..
  })
  .on('error', err => {
    console.error('Error %d: %s', err.code, err.message);
  });
  1. result:
node index.js 
index.js:2
import KubeWatch from 'kube-watch';
^^^^^^
SyntaxError: Unexpected token import
[...]

dcolens avatar Feb 13 '17 13:02 dcolens

you need to use babel to precompile it first

sheerun avatar Mar 07 '17 00:03 sheerun

@sheerun I'm having the same problem .. How do I precompile with babel?

rafaelsilvaa10 avatar Aug 29 '17 03:08 rafaelsilvaa10

there are different methods for different environments, please check their docs

sheerun avatar Sep 02 '17 09:09 sheerun