Trouble installing Servicenow CLI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2021 12:03 PM
I am having a heck of a time getting the Servicenow CLI working.
MacOS Big Sur 11.3.1
node: v16.2.0
npm: 7.13.0
I have it installed via the downloaded installer. I was able to add the ui-component extension and configure the default user to connect to my instance. However all other commands that I have tried fail with this
myUserName@MycomputerUser snUIBuilder % snc ui-component --help
node:internal/modules/cjs/loader:944
throw err;
^
Error: Cannot find module 'keytar'
Require stack:
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/keytar-synthesizer.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/common/connection-utils.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/api/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/runner/plugin-factory.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/runner/index.js
- /Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
at Function.resolve (node:internal/modules/cjs/helpers:99:19)
at rebuildKeytarBindings (/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/keytar-synthesizer.js:35:42)
at module.exports (/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/keytar-synthesizer.js:46:9)
at Object.<anonymous> (/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/index.js:23:205)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/keytar-synthesizer.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/common/connection-utils.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/api/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/runner/plugin-factory.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/runner/index.js',
'/Users/myUserName/.snc/.extensions/ui-component/node_modules/@servicenow/cli/src/index.js'
]
}
It is nearly the same error from any other command such as
$ snc ui-component project --name @myorg/movie-quotes
I have looked in the file structure to confirm that the .snc/.extensions/ui-component/node_modules/@servicenow/cli-glide/connection/auth/credential-manager/keytar-synthesizer.js and other listed files indeed exist and are present.
The best I can guess is that the keytar-synthesizer.js which is supposed to outputting the keytar module is not working?
If it helps at all here is that file unminified:
const { spawnSync: e } = require("child_process");
const r = require("path");
const n = require("fs");
const t = require("os");
const rebuildKeytarBindings = () => {
const findDependencyPath = (e) => {
const t = r.join(e, "./package.json");
const s = r.dirname(e);
if (n.existsSync(t)) return r.dirname(t);
if (e === s) throw new Error("Could not find package.json");
return findDependencyPath(s);
};
const s = findDependencyPath(require.resolve("keytar"));
if ("win32" === t.platform()) {
const r = require.resolve("prebuild-install/bin.js");
e("node", [r], { cwd: s });
} else e("npm", ["run", "install"], { cwd: s });
};
module.exports = () => {
let e;
try {
e = require("keytar");
} catch (r) {
rebuildKeytarBindings(), (e = require("keytar"));
}
return e;
};
Any help would be much appreciated!
- 2,912 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2021 01:19 PM
Similar issues here. Trying to setup with Quebec on Windows10 machine
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2021 03:14 AM
Reposting this from my reply in https://community.servicenow.com/community?id=community_question&sys_id=4deca8de1beb4454fff162c4bd4bcbe0:
To anyone experiencing this in 2021 onwards with ServiceNow CLI (the new one), already using node 12 and still running into this error...
I fixed it by going into the ui-component extension folder, then installing keytar@5.0.0 (as required) manually:
$ cd ~/.snc/.extensions/
$ npm install keytar@5.0.0
$ smr snc ui-component --help
Usage: <cmd> [args]
For help, run: <cmd> --help
...
It works after!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2022 04:30 AM
Awesome. This worked wonders for me.
Thanks!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 10:53 AM
This thread is a little bit old, and we dealt with this issue this morning.
.snc and .extensions are hidden, when you us ls in a command line to find them. But they are still there.
Instead of installing keytar version 5.0.0, go here
~/.snc/.extensions/
And run
npm install keytar
Then you should be all set and won't get the error.