Cannot install external task client

I am not beeing able to install external task client using npm… can someone help me with that? I execute the command below and nothing happens after that (no message is shown).

$ npm install -s camunda-external-task-client-js
[..................] / normalizeTree: sill install loadCurrentTree

If I try to execute the worker I just created, I get the following error (meaning it did not installed external task client)

$ node ./PrintDataWorker.js
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'camunda-external-task-client-js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (C:\Users\erikasegatto\Desktop\CamundaJS\PrintDataWorker.js:1:28)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Can you show the code of your worker?

Its just printing my task… i’m not doing anything yet…

const { Client, logger, Variables } = require("camunda-external-task-client-js");

// configuration for the Client:
const config = { baseUrl: "http://localhost:8080/engine-rest", use: logger };

// create a Client instance with custom configuration
const client = new Client(config);

// susbscribe to the topic: 'creditScoreChecker'
client.subscribe("PrintarTela", async function({ task, taskService }) {
  // Put your business logic
  console.log(task)
  // complete the task
  await taskService.complete(task, processVariables);
});

I was able to build it locally without any problems, perhaps there could be a firewall issue or you might not have admin rights in your console.

Actually, it was an error in the registry of npm that was preventing the instalation of the task-client to be done correctly!

1 Like

Hi @erikasegatto , same problem here, what did you do to solve it?

I am not beeing able to run my project who uses nodeJS version14 , And i installed external task client with this command “npm install -s camunda-external-task-client-js”

Hello @user8 !!!

it looks like node couldn’t find all the dependencies it needed… more precisely ansi-styles.

Try to reinstall everything again using the npm install command

if it doesn’t work, check if the package.json file has this dependency in it… if it doesn’t, install it manually using:

npm install #ansi-styles

If it still doesn’t work, as a last alternative try to update the node version, remembering to check the compatibility with your dependencies :smiley: