Node for Max in standalone

Jakob Hougaard Andersen's icon

Hi folks

I am really excited about the Node for Max features in Max 8.
But does anyone know if it is possible to build a standalone application using Node and an external node package?

I got it working within Max following this great turorial:
https://youtu.be/RR5AlDgYI2s
However, when I build an application (.app) and try to run it, the node debugger says that it cant start the process because it can’t find the specific package - in my case, the wavefile package (https://www.npmjs.com/package/wavefile). I have tried to install the package manually into some of the directories within the .app folder where I found other Node packages, but with no luck.

It would be really great if it was possible use Node (along with packages) also in standalones.

Best, Jakob

Florian Demmer's icon

Hey Jakob,

I just came across this thread now. Have you seen this post explaining how to do it: https://cycling74.com/forums/node-for-max-bundling-in-collectives-standalones-and-max-for-live-devices

Florian

Jakob Hougaard Andersen's icon

Hi Florian,
No I hadn't seen that post, so thanks a lot :-)
Best, Jakob

miltnerunit's icon

Florian, thank you for this tutorial, I hadn’t seen it either and it's exactly what I was looking for! Cleared up some things. I was going to put my main patch right inside the root folder and make another directory /subpatches but realized I should probably set up like the tutorial instead. I thought it would be more like:

Root folder 'SomeSoundApp' and all this on the first level, including the main patch ('playground' right now), plus a /subpatchers folder

My app is a standalone that serves a static web page and has some other JS files that are client-side/helpers. I was going to add a folder called 'js' on same level as patchers/ and node_content/, is that what you'd recommend?

Florian Demmer's icon

Hey.

As mentioned in the other post we recommend making a single folder in the root of your project for the Node content in order to keep a clean and sane way of organizing your project and maintaining the project's search path in a simpler way.

One other thing I'd recommend by looking at your screenshot would be to introduce prefixed file names. Especially file names like index.js and server.js are somewhat generic and might lead to unexpected behaviour when there are naming conflicts in your search path.

Does that help?
Florian

miltnerunit's icon

Yeah. They're generic like that because I took the setup instructions very literally - I tried setting it up as a Node Express project before adding Max patches to the mix, and in the instructions I followed (off MDN), it seemed to really want 'entry point' to be called 'index' when building the package.json . Now I'm kind of finding out that I don't really need to build the project like that, and things can be a lot simpler for what I want to do.