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,910 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2023 12:21 PM
I downloaded and installed nvm-windows instead of the regular nvm, and it seems to be working!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 02:37 PM
Does the latest version of the @Servicenow/cli npm package still contain the
cd ~/.snc/.extensions/
path? When I try do it, bash says "No such file or directory"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 10:57 PM
Could be different locations on mac, linux and windows. Try and search either in root dir or your user dir if on windows?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2023 03:59 AM
I have the same issue with Win10.
as @Henry F mentioned. going into .snc/.extensions/ui-component and doing a npm i keytar -g fixes the issue for me.