# Examples not included when installing node

**URL:** <https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373>\
**Category:** Developing Nodes\
**Tags:** dashboard-2\
**Created:** [30 May 2024 08:29 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373 "2024-05-30T08:29:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2024 08:29 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/1 "2024-05-30T08:29:02Z")

</div>

I have just released the initial version of a new dashboard 2 ui node [@colinl/node-red-dashboard-2-ui-gauge-classic](https://flows.nodered.org/node/@colinl/node-red-dashboard-2-ui-gauge-classic) which is a multi-needle classic style gauge. It is working ok, but the examples are not being installed. They are .json files in a folder called `examples` in the repository. Is there something else I need to do to get the examples included?

---

<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:** [30 May 2024 08:40 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/2 "2024-05-30T08:40:28Z")

</div>

You havent incuded the examples folder in your package Colin

```auto
    "files": [
        "dist/*",
        "nodes/*",
        "ui/*",
        "resources/*"
    ],

```

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2024 08:42 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/3 "2024-05-30T08:42:56Z")

</div>

I looked at other nodes and they do not specify `examples` either, but I realise now that they don't specify `files` at all, so it defaults to everything. This is the first time I have published a node where `files` is specified.

Thanks. New release coming shortly.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 May 2024 09:04 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/4 "2024-05-30T09:04:31Z")

</div>

> [@Colin](#):
>
> This is the first time I have published a node where `files` is specified.

> The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency.

I think that most of us ignore it. 😀 On the assumption that, if we've put something in the repo, it should be in the published package.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2024 13:10 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/5 "2024-05-30T13:10:33Z")

</div>

Yes, it is there is this node because I started with ui-example node, which has the files specified. I haven't actually looked to see if it is necessary.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [30 May 2024 13:14 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/6 "2024-05-30T13:14:58Z")

</div>

If you prefer a negative style rather than an include style (which can be a bit fragile when you add future folders and forget to add them), you can add a `.npmignore` file instead.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2024 13:29 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/7 "2024-05-30T13:29:58Z")

</div>

> [@TotallyInformation](#):
>
> (which can be a bit fragile when you add future folders and forget to add them), you can add a `.npmignore` file instead.

Less fragile certainly, but a bit opaque maybe.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [30 May 2024 19:22 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/8 "2024-05-30T19:22:52Z")

</div>

@Colin - Don't know if your aware or not but you can include spaces in the names of the examples to make them more readable in the NR examples section.

So for example, `MultiNeedleGaugeExample.json` could be `Multi Needle Gauge Example.json`, and of course it would then display as `Multi Needle Gauge Example` in examples.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [30 May 2024 20:17 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/9 "2024-05-30T20:17:33Z")

</div>

> [@Paul-Reed](#):
>
> you can include spaces in the names of the examples to make them more readable in the NR examples section.

I suppose it is my age that means that spaces in filenames have always been an anathema to me.  
You are right though, perhaps I should hold my nose in this case.

---

<div class="post-metadata">

**Author:** ![kevinGodell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kevingodell/32/27040_2.png) [@kevinGodell](https://discourse.nodered.org/u/kevinGodell)\
**Post date:** [31 May 2024 16:06 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/10 "2024-05-31T16:06:58Z")

</div>

> [@Colin](#):
>
> I suppose it is my age that means that spaces in filenames have always been an anathema to me.  
> You are right though, perhaps I should hold my nose in this case.

Yeah, I didn't like using spaces in the filenames either, but I needed formatting with spaces. Perhaps we can ask for an enhancement that will allow underscores to generate the proper spaces in the examples?

> [@Colin](#):
>
> This is the first time I have published a node where `files` is specified.

In my opinion, using the `files` whitelist is the safest option and best option. I have accidentally included some test files in the past simply because they were in the directory when publishing. And then to deal with unpublishing a package from npm, argh, real pain in the... Another thing you can do before publishing is to run `npm pack` and it will show you the list of files included.

---

<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:** [30 July 2024 16:07 UTC](https://discourse.nodered.org/t/examples-not-included-when-installing-node/88373/11 "2024-07-30T16:07:00Z")

</div>

Closed on 30 July 2024 16:07 UTC

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