Open andrew2015 opened 3 years ago
As shown in the example here, in Electron version of the app you can import core node libraries and test it right away in System Designer.
For modules from npm, you can require it normally in behaviors, but you can not test it with System Designer. You will need to export the system in Node.js format and follow these steps of the documentation:
npm install system-runtime
npm install moment
node mysystem.js
I will update the documentation to explain how to use a npm module.
When I export my system to Node and run it as per these instructions, I get the following error: "runtime: error when calling the action 'render' on component 'page-html' (HTMLComponent class): document is not defined". This occurs for every reference to 'document'.
This error does not occur in System Designer.
Am I missing something?
It does not work because the system you run with node contains a reference to document
(see https://developer.mozilla.org/en-US/docs/Web/API/document) which is not managed by Node.js.
It works in System Designer because the system is executed in a browser (Chromium for the desktop version to be more precise), so you have access to document
.
I will update the documentation to add this missing information.
That makes sense, thank you.
Tjerk
On Wed., Mar. 2, 2022, 6:03 p.m. Erwan Carriou, @.***> wrote:
It does not work because the system you run with node contains a reference to document (see https://developer.mozilla.org/en-US/docs/Web/API/document) which is not managed by Node.js.
It works in System Designer because the system is executed in a browser ( Chromium for the desktop version to be more precise), so you have access to document.
I will update the documentation to add this missing information.
β Reply to this email directly, view it on GitHub https://github.com/design-first/system-designer/issues/137#issuecomment-1057479108, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXORIMSRBZ7ZD7DGU6SQFS3U57XUVANCNFSM4R2XKUMQ . You are receiving this because you commented.Message ID: @.***>
I'm trying the exact example you provide in test-a-server-side-application and I'm getting the following error: error: error when calling the action 'start' on component 'be94220d-f394-4dec-8532-0a05401cef76' (_System class): require is not defined
I don't understand what I'm missing here...
Do you have the latest version of System Designer (v5.2.0) ? There was an issue with node API in older versions.
Hmm, I haven't checked the version, I'll make sure it's up to date and I'll try again.
Thanks, Tjerk
On Tue., Apr. 12, 2022, 1:37 p.m. Erwan Carriou, @.***> wrote:
Did you have the last version of System Designer (v5.2.0) ?
β Reply to this email directly, view it on GitHub https://github.com/design-first/system-designer/issues/137#issuecomment-1097005821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXORIMSNQDIMVBBIE7TPBYTVEWYGPANCNFSM4R2XKUMQ . You are receiving this because you commented.Message ID: @.***>
My version was out of date...
I'll have to remember to check for new versions π
Finally off to the races!
Thank you π Tjerk
On Tue., Apr. 12, 2022, 1:37 p.m. Erwan Carriou, @.***> wrote:
Did you have the last version of System Designer (v5.2.0) ?
β Reply to this email directly, view it on GitHub https://github.com/design-first/system-designer/issues/137#issuecomment-1097005821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXORIMSNQDIMVBBIE7TPBYTVEWYGPANCNFSM4R2XKUMQ . You are receiving this because you commented.Message ID: @.***>
does system design support to import js modules from npmjs repo and call it in behavior?