ZOWE CLI install: Failed to load Keytar module
search cancel

ZOWE CLI install: Failed to load Keytar module

book

Article ID: 260221

calendar_today

Updated On:

Products

Brightside

Issue/Introduction

Run "zowe config set "profiles.base.properties.password" prompt* --global-config" and found the following:

Command Error:
Unable to securely save credentials.
Error Details:
Possible Solutions:
 - Reinstall Zowe CLI. On Linux systems, also make sure to install the prerequisites listed in Zowe CLI documentation.
 - Ensure Zowe CLI can access secure credential storage. Zowe CLI needs access to the OS to securely save credentials.

Found no error during the ZOWE CLI installation but the imperative log contained errors:

Secure vault not enabled. Reason: Failed to load Keytar module: Module did not self-register: '\\?\C:\Users\XXXX\AppData\Roaming\npm\node_modules\@zowe\cli\node_modules\keytar\build\Release\keytar.node'.

Environment

Release : 4.0

Cause

NPM controls the location for the installation of Zowe CLI.
The default location into which NPM installs packages is %AppData%\npm

Site has security policies to prevent loading DLLs from some directories - User has no authority to load the keytar DLL (keytar.node) under user's  %APPDATA%  directory. 

Resolution

Change the default NPM installation location by setting NPM prefix: 
npm config set prefix C:\YourDesiredDirectory

From then on, all normal, global NPM install commands will place apps under  C:\YourDesiredDirectory.
npm install -g zowe-cli.tgz