Skip to main content
Stefan Riedmann
Inspiring
March 29, 2018
Answered

Extension with nodejs, copyFileSync is not a function

  • March 29, 2018
  • 1 reply
  • 2142 views

I can’t get Node.js to work – but I need filesystem access. I double and triple checked the manifest, documentations and existing threads...

I included enable-nodejs to the manifest and iFrame

Then I do

var fs = require(‘fs’)

but I get ‘copyFileSync is not a function’ when I try to use fs.

Any help is highly appreciated!

This topic has been closed for replies.
Correct answer Stefan Riedmann

Already solved it myself through the manifest. Make sure that

1. The tag <ExtensionManifest> and <RequiredRuntime> have the attribute Version="7.0"

2. Make sure the required <CEFCommandLine> tag with its child is within the <Resources> tag. In some Adobe examples it's wrong.

1 reply

Trevor:
Legend
March 29, 2018

You  need mixed-content

<CEFCommandLine>

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

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

</CEFCommandLine>

From the md

Accessing nodejs APIs in iframe

nodejs symbols will not be available in iframe's global context, only way you can access nodejs APIs within iframe's context is through cep_node. When --mixed-context is enabled, global node symbols and cep_node is available within iframe's global context as browser and node gets executed at the same context. It is also important to note that, if you have existing code to check or use nodejs symbols in iframe's global context, it used to work till last release and in the current release, it breaks in separate context mode.

Stefan Riedmann
Inspiring
March 30, 2018

Hi and thanks for your answer!

But even though I have both parameters defined, I just see for example CSEvent, CSInterface, VulcanInterface or cep in the global and frame context. I think I'm still missing something, but I have no clue...

It wouldn't have anything to do with me using jQuery and Angular...??

Stefan Riedmann
Stefan RiedmannAuthorCorrect answer
Inspiring
April 4, 2018

Already solved it myself through the manifest. Make sure that

1. The tag <ExtensionManifest> and <RequiredRuntime> have the attribute Version="7.0"

2. Make sure the required <CEFCommandLine> tag with its child is within the <Resources> tag. In some Adobe examples it's wrong.