snc ui-component develop command throwing error.

Kishore Pechett
Tera Contributor

Hi,

I have written a basic custom component to display some HTML elements. I have created a servicenow cli profile, able to connect to the instance using snc,  npm install was successful.  I have below app versions in my local:

npm: '6.13.4'
Node.js v12.16.1
"ui-component": "21.0.7"
"snc": "1.1.0"

Now, When I run the command snc ui-component develop --entry ./element.js --open true --port 3001. I'm getting the following error.  I have tried upgrading or downgrading the app versions, tried installing keytar but it is still throwing error.

PS C:\Users\kpechetti\Desktop\m365-snow-va-latest\m365supportintegration-snow> snc ui-component develop --entry ./element.js --open true --port 3001      
internal/modules/cjs/loader.js:1208
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: Module did not self-register: '\\?\C:\Users\kpechetti\.snc\.extensions\ui-component\node_modules\keytar\build\Release\keytar.node'.
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1208:18)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\kpechetti\.snc\.extensions\ui-component\node_modules\keytar\lib\keytar.js:1:14)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)
    at Function.Module._load (internal/modules/cjs/loader.js:901:14)

 

Can someone please help resolve this?

1 ACCEPTED SOLUTION

Shasank
ServiceNow Employee
ServiceNow Employee

Once keytar is installed globally, please uninstall and install ui-component extension of snc. This would help ui-component pick the right keytar module.

 

// Remove ui-component

snc extension remove

Extension name: ui-component

 

// Add ui-component

snc extension add

Extension name: ui-component

View solution in original post

10 REPLIES 10

Shasank
ServiceNow Employee
ServiceNow Employee
  • Ensure node version is 12.x [12.16.1]
  • Install keytar globally
  • npm i -g keytar

This should solve the problem.

Hi Shasank,

I tried your solution and still getting the same error.

Is there anything else that can cause this issue?

- Is the keytar lib installed in the right node version? [switch to the right version both during keytar installation and running  snc commands, in case you have multiple node versions installed]

- Once keytar is installed, rerun npm i and then run deploy

Hey Shasank,

 

I cross checked all the version, tried re installing everything. I removed node modules and package-lock.json, I ran npm cache clear, I tried installing keytar globally first and then ran npm i.  Unfortunately im still getting the same error.

Below are the versions I have:

find_real_file.png

Error

find_real_file.png

Can you please check the above details and let me know if I need to do anything else?