While packaging a project with blessed, it wont run properly(but runs well without pkg).
The process of reproducing this problem:
blessed-contrib-masteryarn install && yarn add blessed && cd examples && pkg time.js --targets node10-win-x86./time.jsError information:
TypeError: Cannot read property 'isAlt' of undefined
at Screen.leave (C:\snapshot\blessed-master\node_modules\blessed\lib\widgets\screen.js:309:21)
at Screen.destroy (C:\snapshot\blessed-master\node_modules\blessed\lib\widgets\screen.js:411:8)
at C:\snapshot\blessed-master\node_modules\blessed\lib\widgets\screen.js:216:14
at Array.forEach (<anonymous>)
at process.Screen.bind.process.on.Screen._exceptionHandler (C:\snapshot\blessed-master\node_modules\blessed\lib\widgets\screen.js:215:30)
at process.emit (events.js:182:13)
at process._fatalException (internal/bootstrap/node.js:484:27)
Platform:
Windows 10, Yarn 1.9.2, node 10.1.10
I'm not sure the problem is caused by blessed or pkg, maybe someone can kindly figure it out?
I'm having this issue as well.
The reason is 'cos some files in the blessed module are not included by pkg. Try adding the following in your package.json:
"pkg": {
"assets": "node_modules/blessed/**/*"
}
@tongwing Wow, thanks, i'll have a try
Same issues.
add pkg in my package.json
"pkg": { "assets": "node_modules/blessed/**/*" }
still throw error:
TypeError: Cannot read property 'isAlt' of undefined
Please try with [email protected]
Note that there is a "bug" in screen.js, fixed by this PR, which prevents the actual error from showing in cases where the app / screen didn't even get to initialize properly (I assume). This is the case indicated by @ChrisPei, above. I had the same issue but fixed it by doing what is shown in the PR. Now I get this error when running the packaged binary:
Error: File '/**/multi-git/node_modules/blessed/usr/xterm' was not included into executable at compilation stage. Please recompile adding it as asset or script.
at error_ENOENT (pkg/prelude/bootstrap.js:429:17)
at readFileFromSnapshot (pkg/prelude/bootstrap.js:657:29)
at Object.fs.readFileSync (pkg/prelude/bootstrap.js:700:18)
at Tput.readTerminfo (/snapshot/multi-git/node_modules/blessed/lib/tput.js:157:13)
at Tput.compileTerminfo (/snapshot/multi-git/node_modules/blessed/lib/tput.js:623:28)
at Tput.injectTerminfo (/snapshot/multi-git/node_modules/blessed/lib/tput.js:627:27)
at Tput._useXtermInfo (/snapshot/multi-git/node_modules/blessed/lib/tput.js:118:15)
at Tput.setup (/snapshot/multi-git/node_modules/blessed/lib/tput.js:92:10)
at new Tput (/snapshot/multi-git/node_modules/blessed/lib/tput.js:63:10)
at Program.setupTput (/snapshot/multi-git/node_modules/blessed/lib/program.js:251:26)
I took the advise of the error message and @Losses and now my app runs okay at first glance.
Most helpful comment
The reason is 'cos some files in the
blessedmodule are not included bypkg. Try adding the following in your package.json:"pkg": { "assets": "node_modules/blessed/**/*" }