Cannot read property 'once' of undefined
See original GitHub issueWhen start the project by express.
/Users/lxxyx/Desktop/own/yun-type/node_modules/electron-pdf/lib/index.js:32 electronApp.once(‘ready’, () => { ^
TypeError: Cannot read property ‘once’ of undefined at PDFExporter.start (/Users/lxxyx/Desktop/own/yun-type/node_modules/electron-pdf/lib/index.js:32:16) at Object.<anonymous> (/Users/lxxyx/Desktop/own/yun-type/js_server/app.js:22:10) at Module._compile (module.js:570:32) at Object.Module._extensions…js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.runMain (module.js:604:10) at run (bootstrap_node.js:394:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:509:3
import * as express from 'express'
import * as bodyParser from 'body-parser'
const ElectronPDF = require('electron-pdf')
const app = express()
app.use(bodyParser.json())
const exporter = new ElectronPDF()
app.post('/pdfexport', (req, res) => {
const source:string = req.body.source
exporter.createJob(source, './')
.then((job) => {
job.render()
job.on('job-complete', (r) => {
console.log('pdf files:', r.results)
})
})
})
exporter.on('charged', () => {
//Only start the express server once the exporter is ready
app.listen(3000)
})
exporter.start()
Issue Analytics
- State:
- Created 7 years ago
- Comments:11
Top Results From Across the Web
"Cannot read property 'once' of undefined" when using trying ...
node. js - "Cannot read property 'once' of undefined" when using trying to use gridfs for mongodb - Stack Overflow. Stack Overflow for...
Read more >Cannot read property 'once' of undefined at EventEmitter.ee ...
My request completes with the correct respsonse but an error come with it. Uncaught TypeError: Cannot read property 'once' of undefined at ...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >TypeError: Cannot read properties of undefined ... - MongoDB
I have this code here: import { MongoClient } from "mongodb"; const createConnection = () => { // let current = null; const...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@codecounselor Thank you. I run it at Node but not electron.
Yes it runs on windows, but you have to run
npm install
from the target OS or you won’t get the right binaries