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

you can actually use node 22 and npm 8.5.5
see https://developer.servicenow.com/dev.do#!/reference/next-experience/yokohama/cli/getting-started

 

you have to downgrade the npm version. To install the ui components you have to downgrade npm to 8.5.5.

 

my setup:

  • macos
  • npm: '8.5.5',
    node: '22.1.0',
  • still on washington

 

After installing the ui-component

 

snc version


{
"extensions": {
"ui-component": "27.4.5"
},
"snc": "1.1.2"
}

 

 

i upgraded again to newer npm 10.7.0 and i can still use snc with the commands like ui-component commands like develop and deploy (i actually would not recommend to upgrade npm again)