Skip to main content
Premiopolis
Inspiring
March 7, 2018
Answered

Node JS error: "require is not defined"

  • March 7, 2018
  • 1 reply
  • 11837 views

I'm not sure when it stopped being an available function, but at one point I was able to run Node JS "require" command in the browser context.

So the following...

require("child_process");

...used to work, but now returns an error: "Uncaught ReferenceError: require is not defined"

The manifest.xml does include the two lines (Per David Barranca's HTML Panel Tips #19: CC2015.1 (CEP6.1) Node.js Fixes | Photoshop, etc. )

<Parameter>--enable-nodejs</Parameter>

<Parameter>--mixed-context</Parameter>

Did something change?  Any ideas why it would have stopped working?

This topic has been closed for replies.
Correct answer Premiopolis

Solution:

replaced

require();

with

cep_node.require();

Thanks to to eyali.av for the posting cep_node context for the clue.

1 reply

Premiopolis
PremiopolisAuthorCorrect answer
Inspiring
March 7, 2018

Solution:

replaced

require();

with

cep_node.require();

Thanks to to eyali.av for the posting cep_node context for the clue.