template-archive
template-archive copied to clipboard
Unable to download cto model files if use relative directory on Windows
I think this is a windows directory problem.
The following works
template: (jsonData, grammar, directory) =>
template = await Template.fromDirectory('C:\\home\\projects\\contractpen_node_client\\testcicerofolder')
template.buildGrammar(grammar) if grammar
clause = new Clause(template)
clause.setData jsonData
n1 = clause.generateText()
console.log n1
And this does NOT work.
template: (jsonData, grammar, directory) =>
template = await Template.fromDirectory('testcicerofolder')
template.buildGrammar(grammar) if grammar
clause = new Clause(template)
clause.setData jsonData
n1 = clause.generateText()
console.log n1
It will give this error
(node:8480) UnhandledPromiseRejectionWarning: Error: Failed to load model file. Queue: [{"downloadedUris":{},"url":"https://models.accordproject.org/cicero/runtime.cto","options":{}},{"downloadedUris":{},"url":"https://models.accordproject.org/cicero/contract.cto","options":{}},{"downloadedUris":{},"url":"https://models.accordproject.org/cicero/runtime.cto","options":{}}] Details: {}
at ModelFileDownloader.on (C:\home\projects\contractpen_node_client\node_modules\composer-common\lib\introspect\loaders\modelfiledownloader.js:72:25)
at ModelFileDownloader.emit (events.js:182:13)
at runJob.then.catch (C:\home\projects\contractpen_node_client\node_modules\composer-common\lib\introspect\loaders\jobqueue.js:152:22)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:8480) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8480) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code
I'm not sure what the current working directory is for Node on Windows. Can you try .\ testcicerofolder please.