Tensorflow.js image

I have followed the documentation of tensorflow.js in codelab. But I received this error

Error: pixels passed to tf.browser.fromPixels() can not be null

How to solve it?