AE Extension.Node js external modules don’t work

New Here ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

After Effects 2022 (v22.0.0)

I’m using CEP 11 ( i think. In my manifest.xml  <RequiredRuntime Name="CSXS" Version="6.0" />) ?

Node.js 15.9.0

Chromium 88 

 

So, the fs module it works:

var fs = require('fs')

alert(fs) // restart the extension in AE and i get an [Object] 

 

1 SHARP MODUL ///////////////////

If using “npm install sharp” (image processing module)

var sharp = require('sharp');

alert(sharp) // it doesn't get here, it dosen alert

 

The weird thing is when I use the vscode terminal and try to run the code with F5 shortcut it works. It does a copy of the file in grayscale. (but not when I run it in AE)

 

var sharp = require('sharp');

sharp(gRootPath + '/test/Scene_8_1.png')

.grayscale()

.toFile(gRootPath + '/test/Scene_8_1_changed.jpg')

}



2 GM MODUL ///////////////////

Also i tried installing 

var gm = require('gm'); 

alert(gm) // get back: “function gm(source, height, color){ “

But i wasn't able to use the example show on their npm page:

 

gm(gRootPath + '/test/Scene_8_1.png)

.resize(240, 240)

.noProfile()

.write('gRootPath + '/test/Scene_8_1_changed.jpg', function (err) {

  if (!err) alert('done');

});

 

Nothing happens



3 IM MODUL ///////////////////

var im = require('im');

alert(im) // it doesn't get here, it dosen alert

 

Other modules like font-list work

var fontList = require('font-list');

alert(fontList) // get back [Object} 

 

Also what is the difference between:

var fs = require('fs')

var fs = cep_node.require('fs')

 

Thank you!

TOPICS
Scripting , SDK

Views

37

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

LATEST

I moved this to the After Effects board where you're more likely to get a response...

 

I can't really tell what might be going on there, other than ask if you've tried updating the Required Runtime in the manifest? Here's the latest CEP Cookbook... just in case you haven't checked there.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines