# Files missing when trying to start from a npm package!

**URL:** https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392
**Category:** General
**Created:** [16 June 2020 08:38 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392 "2020-06-16T08:38:53Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 08:38 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/1 "2020-06-16T08:38:53Z")

</div>

I am writing a custom node for audio communication (quiet-js) and I found a [quietjs-bundle (npm package)](https://github.com/edgarogh/quietjs-bundle), so I cloned the repo, edited dependencies version, and some minor fixes and I [published it to npm](https://www.npmjs.com/package/quietjs-bundle-2) too (don`t want to wait until original developer updates it), and started working on the node.

So I installed my package successfully and the post-install is also finished successfully. ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7cadc5d87101319576cca2fec09708bc41f00573.png)  
(used .nodered directory just for example)

I required the package inside send.js (custom node) `const quiet = require('quietjs-bundle-2') `  
And used `npm link` to link it as node-red module.  
Now when starting node-red in console i get an error:

```auto
[error] [send:6eb5368b.3a2f88] Error: Bundle not found. Did you generate it?

```

The index.js file is just a try/catch for the module.export \_bundle.js  
I can easily rewrite the code but i want to keep it original as much as I could.

Not sure where to start to find a solution for this, could anyone help?

---

<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: [16 June 2020 09:59 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/2 "2020-06-16T09:59:14Z")

</div>

Does your custom node package.json have a dependency entry for `quietjs-bundle-2`?

My suggestion would be to have you custom node src in a separate area/directory then in your .node-red folder, issue an `npm install /dev/node-red-contrib-mynode` to install (link) your dev work in node-red. That way, any (most\*) changes while you develop will get picked up on a restart of node-red.

(\* Changes to packages would likely need another `npm install /srcfolder`)

---

<div class="post-metadata">

### Author: ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)
#### Post date: [16 June 2020 10:18 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/3 "2020-06-16T10:18:01Z")

</div>

does this package even work in nodejs or is it browser only?

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 10:25 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/4 "2020-06-16T10:25:22Z")

</div>

Yes i have quietjs-bundle-2 in my nodes package.json.

The node folder i am using is located in home directory , and i have used `sudo npm link` and then in .node-red folder `npm link node-red-contrib-quiet`  
I have tried to install in .node-red via the npm as you suggested , still same 😕

The quiet-bundle is also located in home folder.

> [@cinhcet](#):
>
> does this package even work in nodejs or is it browser only?

It should work as it is controled via the console, check [index.html](https://github.com/iainnash/quietjs-bundle/blob/master/test/index.html)  
i haven`t tried to run the test yet.

---

<div class="post-metadata">

### Author: ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)
#### Post date: [16 June 2020 10:28 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/5 "2020-06-16T10:28:59Z")

</div>

> [@lizzardguki](#):
>
> It should work as it is controled via the console, check [index.html](https://github.com/iainnash/quietjs-bundle/blob/master/test/index.html)  
> i haven`t tried to run the test yet.

what do you mean with it is controlled via the console?  
Modules in Node-RED run in a node.js runtime, not in the browser.  
Or I just might not get what you mean.

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 10:50 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/6 "2020-06-16T10:50:48Z")

</div>

Read the [source code](https://github.com/iainnash/quietjs-bundle/) it should run fine in nodejs

Okay, so I figured out what was happening, the quietjs-bundle-2 was not publishing the \_bundle.js  
I resolved the issue, Not sure if the developer even tested this script because now I get an error when trying to start it via Node.js:

```auto
Error: ENOENT: no such file or directory, open 'https:/quiet.github.io/quiet-js/javascripts/quiet-emscripten.js.mem'

```

The link exists, help? 🤮

---

<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: [16 June 2020 10:53 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/7 "2020-06-16T10:53:30Z")

</div>

> [@lizzardguki](#):
>
> used `sudo npm link` and then in .node-red folder `npm link node-red-contrib-quiet`

You no longer need to do all that. As Steve indicates, you can "install" direct from a local folder. That will directly link the development folder to your Node-RED instance. This is how I do all my node development & it is really effective.

As steve also indicated, you can get odd things happening if you have run npm install on your development folder but not from the userDir folder. You can also get issues the other way around too! npm is one very strange beast. Don't get me started on how pre-install scripts don't do what is expected. Nor on the arcane way that npm searches for things.

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 10:56 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/8 "2020-06-16T10:56:53Z")

</div>

> [@TotallyInformation](#):
>
> You can also get issues the other way around too! npm is one very strange beast. Don't get me started on how pre-install scripts don't do what is expected. Nor on the arcane way that npm searches for things.

I am not an experienced js dev, but i can read code and understand it, and i debug a lot, but last night was a nightmare with this project 😕

---

<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: [16 June 2020 10:59 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/9 "2020-06-16T10:59:52Z")

</div>

Without wishing to sidetrack the conversation, you should see the hoops I've had to jump through for uibuilder. Not least of which was wasting 1/2d over the weekend trying to get pre-install scripts to work. In the end I had to give up because something very strange happens and there appears to be no reliable way to pre-install peer dependencies without making a mess of the main install. When peer dependencies were automatically installed, this was never a problem.

---

<div class="post-metadata">

### Author: ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)
#### Post date: [16 June 2020 11:00 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/10 "2020-06-16T11:00:38Z")

</div>

> [@lizzardguki](#):
>
> Read the [source code](https://github.com/iainnash/quietjs-bundle/) it should run fine in nodejs

[quietjs-bundle/\_bundle.js at master · iainnash/quietjs-bundle · GitHub](https://github.com/iainnash/quietjs-bundle/blob/master/_bundle.js#L64) how should that work in nodejs?

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 11:06 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/11 "2020-06-16T11:06:44Z")

</div>

index.js is exporting it as an module?

---

<div class="post-metadata">

### Author: ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)
#### Post date: [16 June 2020 11:09 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/12 "2020-06-16T11:09:57Z")

</div>

The line of code I just posted makes use of `window.AudioContext`, which is not something that is available in nodejs.  
There is no window object and also not the audio API.

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 11:18 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/13 "2020-06-16T11:18:59Z")

</div>

I guess i need much more too learn, thank you for your time!

---

<div class="post-metadata">

### Author: ![cinhcet](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cinhcet/32/438_2.png) [@cinhcet](https://discourse.nodered.org/u/cinhcet)
#### Post date: [16 June 2020 11:24 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/14 "2020-06-16T11:24:01Z")

</div>

no Problem. I also have to state that I am not 100% sure if the code makes use of a different api that is available in nodejs, but as far as I can see from quickly scanning through the code, that audio context is always called if you want to do something with it, so it needs this API.

Maybe you explain what you want to achieve and our Node-RED community is for sure willing to help

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [16 June 2020 11:30 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/15 "2020-06-16T11:30:38Z")

</div>

I will create another topic, thank you!

---

<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 June 2020 11:30 UTC](https://discourse.nodered.org/t/files-missing-when-trying-to-start-from-a-npm-package/28392/16 "2020-06-30T11:30:40Z")

</div>

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