ReferenceError: nativeRequire is not defined

Hi,

I have been trying to run some shell and applescript, I had the custom-module path set to the node_modules folder where npm and child_process were installed locally.

but I have been getting this error: button_1.onValue javascript error at line 1: ReferenceError: nativeRequire is not defined. I would really appreciate your help!! Thank you in advance!

const { exec } = nativeRequire('child_process');
const as = get("variable_1"); 
console.log("Retrieved as code:", as);

Custom module functions such as nativeRequire can only be called in the custom module file, not in widget scripts.

2 Likes