Error "Failed to launch chrome!" while generating report
-
Hello,
I'm trying to generate a pdf report with jsreport 2.11.0 on Windows Server 2019 machine, but generation fail and on last failed requests table there is error:"Failed to launch chrome! spawn C:\Windows\TEMP\jsreport\compile\jsreport-2.11.0-SJu_2xpjD\chrome\chrome.exe ENOENT TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
Error: Failed to launch chrome! spawn C:\Windows\TEMP\jsreport\compile\jsreport-2.11.0-SJu_2xpjD\chrome\chrome.exe ENOENT TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at onClose (D:\snapshot\jsreport\node_modules\puppeteer\lib\Launcher.js:348:14) at ChildProcess. (D:\snapshot\jsreport\node_modules\puppeteer\lib\Launcher.js:339:64) at ChildProcess.emit (events.js:311:20) at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21)"Then I check the existence of chrome.exe in the C:\Windows\TEMP\jsreport\compile\jsreport-2.11.0-SJu_2xpjD\chrome directory, and I found that all files in the directory were disappeared, except for directories, that were empty.
It seems like some task delete all files in C:\Windows\TEMP\jsreport\compile\jsreport-2.11.0-SJu_2xpjD\chrome.
I looked for this error in jsreport forum and I found this topic "https://forum.jsreport.net/topic/1548/jsreport-2-7-2-all-locked-up/4", which suggest to change the default temp directory.
Well, I tried to change default temp directory, but only directories "autocleanup" and "core" were moved to new location; instead, "cli" and "compile", that contains chrome directory, remain in the previous temp directory c:\windows\temp\jsreport.
Any suggestion?
-
How do you apply the tempDirectory?
If I apply it with the arg like this
jsreport.exe --tempDirectory=c:\work\temp\binary\tmp --help
The directories are properly filled.
-
I changed jsreport.config.json file by adding "tempDirectory" property, like this:
{
"httpPort": 5488,
"store": {
"provider": "fs"
},
"blobStorage": {
"provider": "fs"
},
"logger": {
"console": {
"transport": "console",
"level": "debug"
},
"file": {
"transport": "file",
"level": "info",
"filename": "logs/reporter.log"
},
"error": {
"transport": "file",
"level": "error",
"filename": "logs/error.log"
}
},
"allowLocalFilesAccess": true,
"reportTimeout": 60000,
"templatingEngines": {
"strategy": "http-server"
},
"extensions": {
"authentication": {
"cookieSession": {},
"admin": {
"username": "admin",
"password": "password"
},
"enabled": false
},
"scripts": {
"strategy": "http-server"
}
},
"licenseKey": "{perpetual_license}",
"tempDirectory": "{new_temp_dir}"
}And then restarted jsreport service.
-
Config file is parsed later, so this won't work for the jsreport binary.
You can do the following# uninstall the service jsreport.exe win-uninstall # install again but with environment variable for temp directory set tempDirectory=c:\work\myappxxxx\mytemp&&jsreport.exe win-install
-
Thanks for your reply. I tried to reinstall jsreport service specifying temp directory, and now the path to executable is changed from:
C:\Users\ADMINI~1\AppData\Local\Temp\2\jsreport\compile\jsreport-2.11.0-SJu_2xpjD\nssm64.exe
to:
{new_temp_directory}\compile\jsreport-3.7.1-405f5Qt-s\nssm64.exeBut the unzipped chrome directory still remain in C:\Windows\Temp\jsreport\compile\jsreport-3.7.1-405f5Qt-s\chrome
-
I see, my mistake, so the env variables can't be passed to the service this way.
What needs to be done, is the following.Open
regedit
and navigate to the:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\jsreport-server-exe\Parameters
Edit the
AppEnvironment
and add thetempDirectory
.Then restart the service.
This is a bit painfull, I will submit a task to our backlog to make it easier.
-
Ok, in this way seems that "\compile\jsreport-3.7.1-405f5Qt-s\chrome" directory is properly moved into tempDirectory specified into AppEnvironment variable.
All I can do now is monitoring the pdf report generation feature on our application, hoping that no unknown process can delete chrome content anymore.
Thanks!