electron-clipboard-watcher icon indicating copy to clipboard operation
electron-clipboard-watcher copied to clipboard

Cannot read property 'readText' of undefined

Open omaraflak opened this issue 9 years ago • 2 comments

Hello, I tried to use your project but this error poped up:

D:\www\myProject\node_modules\electron-clipboard-watcher\index.js:39
  let lastText = clipboard.readText()
                          ^

TypeError: Cannot read property 'readText' of undefined
    at module.exports (D:\www\Copy Pasta\node_modules\electron-clipboard-watcher\index.js:39:27)
    at Object.<anonymous> (D:\www\Copy Pasta\server.js:20:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:139:18)
    at node.js:974:3

I copied/passed your example on https://www.npmjs.com/package/electron-clipboard-watcher.

Could you help me with this ?

Thank you!

omaraflak avatar Oct 14 '16 22:10 omaraflak

@omaflak I know this is a few months late, but in case this is something that you still are unsure about (or anyone else for that matter) you need to run an instance of electron to get this to work.

Instead of launching your code normally, you need to run with Electron like this electron . which will run in the current directory.

LeonBlade avatar Jan 02 '17 11:01 LeonBlade

Thank you @LeonBlade , I'll try this.

omaraflak avatar Jan 02 '17 11:01 omaraflak