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,908 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 02:25 PM
Does the latest version of the @Servicenow/cli npm package still contain the .snc/.extensions/ path?
When I try to cd to it, bash says "No such file or directory"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2022 03:45 AM
Remove everything you have first (.npm and .snc folders in your root dir).
If you are on M1 Apple silicon, create a Rosetta terminal - https://www.courier.com/blog/tips-and-tricks-to-setup-your-apple-m1-for-development/
Use nvm to install nodejs v12 with the new terminal and install snc again. Follow the instructions found in the pdf from the snc download.
Cross your fingers and hope it works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 07:08 PM - edited 11-18-2022 07:11 PM
Hello, recently had this problem when installing the now-cli. For me it ended up being a versioning issue with node. I had to install Node Version Manager (NVM) so that I could still use the current version of Node for other things, whilst still complying with the Node requirements for NowCli outlined here. Hopefully this helps others also having the KeyTar module error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 02:33 PM
For some reason, when I do nvm ls-remote, I receive back "N/A" in my terminal.
I'm using Git BASH for Windows 10
Do you know how to fix this? Sorry if this is out of scope for the SN forums lol, but I'm having a rough time trying to use the SN CLI
I also think I'm having a version conflict for Node / npm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2023 10:57 PM
Could be many things, seems like it's not connecting to nvm source.
Check e.g. StackOverflow