# Error with library on function node, is a bug?

**URL:** <https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927>\
**Category:** General\
**Created:** [31 December 2021 13:32 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927 "2021-12-31T13:32:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![essereumano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/essereumano/32/48262_2.png) [@essereumano](https://discourse.nodered.org/u/essereumano)\
**Post date:** [31 December 2021 13:32 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/1 "2021-12-31T13:32:56Z")

</div>

Hello everyone and happy new year. I am using node red 2.1.4 and in the function node I have inserted the library moment in the setup tab, it works correctly but if I go back to the tab on message and I click on the button to enlarge the editor window it signals me moment as an error. At this point I have to go back to the standard size of the window and go again to the setup tab and click on the Done button, in this way the error disappears.  
Is this a bug?  
Thanks to those who will answer.  
P.s. Cannot find name 'moment' error. (2304)

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [31 December 2021 13:37 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/2 "2021-12-31T13:37:49Z")

</div>

Can you share a screenshot of what you are seeing to help us understand what you mean?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [31 December 2021 13:39 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/3 "2021-12-31T13:39:39Z")

</div>

> [@essereumano](#):
>
> Cannot find name 'moment' error. (2304)

This looks very much like a Monaco issue Nick.

> [@essereumano](#):
>
> Is this a bug?

Please confirm the code editor you are using.

---

<div class="post-metadata">

**Author:** ![essereumano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/essereumano/32/48262_2.png) [@essereumano](https://discourse.nodered.org/u/essereumano)\
**Post date:** [1 January 2022 14:18 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/4 "2022-01-01T14:18:16Z")

</div>

Yes I confirm, I use Monaco editor, when I can I share a video of the issue

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 January 2022 14:31 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/5 "2022-01-01T14:31:59Z")

</div>

You can paste screenshots directly in the forum.

For videos, upload to YouTube and paste a link.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [1 January 2022 14:42 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/6 "2022-01-01T14:42:00Z")

</div>

A video shouldn't be necessary - just take a couple screenshots that show the relevant things, such as the error.

---

<div class="post-metadata">

**Author:** ![essereumano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/essereumano/32/48262_2.png) [@essereumano](https://discourse.nodered.org/u/essereumano)\
**Post date:** [1 January 2022 16:44 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/7 "2022-01-01T16:44:07Z")

</div>

Ok tomorrow I made a screenshot, I've found this issue on Monaco repo, it's seem like my trouble.  
[https://github.com/microsoft/monaco-editor/issues/2866](https://github.com/microsoft/monaco-editor/issues/2866)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [1 January 2022 16:56 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/8 "2022-01-01T16:56:04Z")

</div>

No, I don't think that is the issue since the module reference works when the editor is not maximised.

It is possible our implementation is not picking up the module when the editor is maximised.

When you create your screenshot could you please raise an issue on the node-red GitHub repository.

---

<div class="post-metadata">

**Author:** ![essereumano](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/essereumano/32/48262_2.png) [@essereumano](https://discourse.nodered.org/u/essereumano)\
**Post date:** [1 January 2022 22:42 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/9 "2022-01-01T22:42:05Z")

</div>

I've open an issue on github as requested. [https://github.com/node-red/node-red/issues/3319](https://github.com/node-red/node-red/issues/3319)  
Here are the screenshoots, the first when I open the function node, no error is reported, the second when I extend the editor reports the error, the third that I click on the done or cancel button in the resized editor continues to give an error. To remove the error I have to go to the setup tab.

 ![Screenshot 2022-01-01 23.35.01](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/9492b8942cfc9f2380929f17682685f26f8a26aa.png)  
 ![Screenshot 2022-01-01 23.35.24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12af632d07c2578fd99842ceea5e93789be1bd41.png)  
 ![Screenshot 2022-01-01 23.35.39](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/9/89ee0da4e2dbe581511f5adb194f3702222e1f02.png)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 March 2022 22:42 UTC](https://discourse.nodered.org/t/error-with-library-on-function-node-is-a-bug/55927/10 "2022-03-02T22:42:07Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
