Closed aprelle closed 4 years ago
Hi,
you get this error because:
I have updated the library so that you will now have a better error message. Example:
runtime: error when calling the action 'install' on component 'runtime' (class '_Runtime'): Cannot find module '/Users/aaa/project/invalid.json'
Thanks for a quick response! The new version gives a better error message indeed:
runtime: error when calling the action 'install' on component 'runtime' (class '_Runtime'): Cannot find module 'undefined/MY_PATH_TO_JSON>'
It looks like "undefined/" is added somewhere on the way to the file path.
I found out that combination with fs.readFile may bring you to the positive result:
fs.readFile(MY_PATH_TO_JSON, 'utf8', (err, data) => { runtime.install(data); ...
I made some search about your issue and it appears that on Windows 10 the command process.env.PWD
(that I use for installing a system) could return undefined
. Are you on Windows 10 ?
I made a fix about this issue and I will deploy a new release with that fix very soon.
The library has been updated with the fix.
I am on Windows 10. After the library update the model can be loaded successfully.
Thanks for the quick help!
You are welcome. And thank you for having found this issue.
I will close this bug as it seems that your problem is fixed now.
Hi again, I am wondering, whether it would be possible to provide an absolute path instead of relative by calling runtime.install?
Yes, it is possible, I will check how to do that (i.e. if I use the same API or add a new one).
Instructions were taken from here: https://designfirst.io/systemruntime/documentation/docs/en/bundle-your-system.html
After the system was defined and saved into a file, I try to load it again using the command:
runtime.install('mysystem.json');
Error: TypeError: $helper.getRuntime(...).system(...).id is not a function ... \node_modules\system-runtime\src\workflow.js:406 .id() at action (... \node_modules\system-runtime\src\workflow.js:406:16)