# Create new file

**URL:** <https://discourse.nodered.org/t/create-new-file/691>\
**Category:** General\
**Created:** [8 June 2018 08:08 UTC](https://discourse.nodered.org/t/create-new-file/691 "2018-06-08T08:08:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThanosMel](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@ThanosMel](https://discourse.nodered.org/u/ThanosMel)\
**Post date:** [8 June 2018 08:08 UTC](https://discourse.nodered.org/t/create-new-file/691/1 "2018-06-08T08:08:04Z")

</div>

I want to create a new file i using the fs function. I get the following error “ReferenceError: fs is not defined” . I tried that but error persists [https://flows.nodered.org/flow/cdf160c36f082dc2a20cd1183ac6cd7d](https://flows.nodered.org/flow/cdf160c36f082dc2a20cd1183ac6cd7d).

---

<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:** [8 June 2018 08:09 UTC](https://discourse.nodered.org/t/create-new-file/691/2 "2018-06-08T08:09:50Z")

</div>

Have you followed the instructions in that example flow to add `fs` to `functionGlobalContext` in your settings file?

---

<div class="post-metadata">

**Author:** ![ThanosMel](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@ThanosMel](https://discourse.nodered.org/u/ThanosMel)\
**Post date:** [8 June 2018 08:11 UTC](https://discourse.nodered.org/t/create-new-file/691/3 "2018-06-08T08:11:50Z")

</div>

yes do i need to download fs via npm?

---

<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:** [8 June 2018 08:16 UTC](https://discourse.nodered.org/t/create-new-file/691/4 "2018-06-08T08:16:16Z")

</div>

`fs` is a built-in node.js module, you don’t have to install anything else.

I see there is a typo in that example. It sets the `fs` property in `functionGlobalContext`, but then in the Function node it does: `var fs = global.get('fs1')` - note the `fs1`. That should match the property name set in `functionGlobalContext`

If you’ve copied that code without checking it, then you’ll have the same typo in your code.

---

<div class="post-metadata">

**Author:** ![ThanosMel](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@ThanosMel](https://discourse.nodered.org/u/ThanosMel)\
**Post date:** [8 June 2018 08:19 UTC](https://discourse.nodered.org/t/create-new-file/691/5 "2018-06-08T08:19:54Z")

</div>

Thank you Nick for the constant support in the forums.
