Migration Tool Crashing
zachbwh opened this issue · 1 comments
Some system context:
jsreport version: 1.10.0
cli version: 1.3.2
node version: 8.9.1
OS: Microsoft Windows Server 2012 R2 Standard
I am trying to migrate my configuration to jsreport v2 but the tool crashes at several stages.
Firstly, after confirming I am ready to start I get this error:
verifying jsreport installation
× Error found during the migration: jsreport entry file "server.js" is not returning a jsreport instance. are you sure that you are running the cli on a jsreport project directory created by "jsreport init" command?.. stack: Error: jsreport entry file "server.js" is not returning a jsreport instance. are you sure that you are running the cli on a jsreport project directory created by "jsreport init" command?.
I believe I have fixed this by changing my server.js slightly to export the jsreport instance but I'm including it in this issue in case I have done it incorrectly.
var jsreport = require('jsreport')()
jsreport.init().then(function () {
// running
}).catch(function (e) {
// error during startup
console.error(e.stack)
process.exit(1)
})
module.exports = jsreport; // THIS LINE WAS ALL THAT WAS ADDED
After making that change, I am able to progress slightly further and can answer the prompt "should we continue"
? should we continue? Yes
√ user confirmed that project backup is done
- initializing jsreport instance in projectUsage of deprecated option `logger.providerName` detected, `logger.providerName` is deprecated and will be removed in future versions, see the new format of "logger" options in https://jsreport.net/learn/configuration
Usage of deprecated option `logger.logDirectory` detected, `logger.logDirectory` is deprecated and will be removed in future versions, see the new format of "logger" options in https://jsreport.net/learn/configuration
2018-11-13T21:36:49.679Z - error: Error occured during reporter init Error: Transport already attached: console, assign a different name
at exports.Logger.Logger.add (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\winston\lib\winston\logger.js:487:11)
at D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:384:14
at Array.forEach (<anonymous>)
at Reporter._configureWinstonTransports (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:356:27)
at D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:216:10
at tryCatcher (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:693:18)
at Async._drainQueue (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
× initializing jsreport instance in project
× Error found during the migration: An error has occurred when trying to initialize jsreport.. Transport already attached: console, assign a different name. stack: Error: Transport already attached: console, assign a different name
at exports.Logger.Logger.add (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\winston\lib\winston\logger.js:487:11)
at D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:384:14
at Array.forEach (<anonymous>)
at Reporter._configureWinstonTransports (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:356:27)
at D:\projects\dotnet\vinsight\reports\jsreports\node_modules\jsreport-core\lib\reporter.js:216:10
at tryCatcher (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\promise.js:693:18)
at Async._drainQueue (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (D:\projects\dotnet\vinsight\reports\jsreports\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:789:20)
at tryOnImmediate (timers.js:751:5)
at processImmediate [as _immediateCallback] (timers.js:722:5)
I'm not sure if there is something wrong with how my jsreport server is set up or if the migration tool is broken. I recently upgraded from jsreport 1.4 to 1.10 but everything seems to be running correctly when I run jsreport start
or node server.js
Any help would be greatly appreciated.
hi! according to logs there is something that is initializing two logger instance during startup. the first that comes to my mind is that your server.js
is not correctly handling some initialization code that makes our cli and migration tool to work correctly, can you update your server.js
file to something like this and try again?
const jsreport = require('jsreport')()
if (process.env.JSREPORT_CLI) {
// export jsreport instance to make it possible to use jsreport-cli
module.exports = jsreport
} else {
jsreport.init().then(() => {
// running
}).catch((e) => {
// error during startup
console.error(e.stack)
process.exit(1)
})
}