Node script and standalone

Dan Nigrin's icon

I'm creating a standalone that uses a node.script object. Everything works perfectly with my .maxpat file, the .js file loaded by the node.script object, and the NPM library (midi-file) all within a single folder on my Mac. Like this:

main.maxpat
my_javascript_for_node.js
node_modules
midi_file
<a bunch of stuff>

I don't use Projects to organize things, I just usually build my standalone from the File --> Build Collective / Application menu. And then if something is needed in my standalone, I move it there manually.

No matter how I move the above files into my standalone's Resources/C74 hierarchy, I can't get it to work - the app crashes every time, with this kind of error:

Thread 0 Crashed:: JUCE Message Thread Dispatch queue: com.apple.main-thread
0 node.script 0x10f5dc30c maxnode_protocol_connection_connect + 12
1 node.script 0x10f5de7ae node_child_process_interface_new + 526
2 node.script 0x10f5e2d82 nodescript_updatepath + 306
3 node.script 0x10f5e23ab nodescript_new + 459
<etc....>

Can someone help me with where the javascript file and NPM module files need to go in the standalone bundle to make this work?

Thanks!

Source Audio's icon

Last time I used node in standalone,

I placed js files and node_modules folder next to mxf file.

In standalone inspector activate "search for missing files"

I don't remember if "Make app subfolder search path" was active or not...

would also depend on platform, I think.

Dan Nigrin's icon

Thanks Source Audio, but that didn't work either, same errors. Scratching my head...

Source Audio's icon

Ok let me build a standalone with a simple node and few other files.

which max version do you use ?

Will let you know.

Dan Nigrin's icon

I'm on the latest version 9. And thanks for trying!

Source Audio's icon

I tried to build standalone on Sonoma / Intel max 9.0.5

If node.js is involved standalone crashes immediately.

Standalone build is terribly big due to needed CEF framework ...

No fun at all.

Source Audio's icon

More infos,

Max 8.6.5 produced same crashes ...

I compiled version without CEF framework, one has to remove

node.js debugger because it uses jweb

Now standalone started without crash.

But not node script.

After compiling mxf file using

excludeexternals true, and replacing original one,

node script finally found node_modules and the rest.

and works as expected.

Source Audio's icon

P.S. if this is for that midi parser ...

if you provide slash based absolute path, no need to place

midi files next to script...

Dan Nigrin's icon

Fantastic re: the workaround, when I'm home later I will try it, thank you!

And yes, it's for the midi parsing stuff, and good tip re: tweak to conformpath parameters.... thanks for that too.

Dan Nigrin's icon

Didn't work for me, not sure why...

I may try and figure out the Project approach and see if I can get that to work...

Source Audio's icon

I gave it up with max 9, too slow for

me compared to max 8 , maybe because of

hacked system - installed sonoma on unsupported hardware...

On windows 10 is ok

szfpro's icon

I also have crashes in Max9 using node script. I let Jeremy Bernstein know and he aknowledged the bug. No word on the updates though. HUGE let down. Even if an update came out I'd be weary if you were shipping standalones. I'm keeping my standalones on 8 until node.script is stable in Max9 standalones.

Hope that helps

Dan Nigrin's icon

Thanks for the additional data point - and optimistic that the Cycling team will sort it out soon.

Jeremy's icon

We fixed this bug months ago, but the fix somehow didn't make it into a release. This will be fixed up in the next one. Thanks for reporting, and for your patience!