vue.jsnpmkeycloakyarn-v2

Vue.js: Incorrectly installed `keycloak-js`


I am trying to use keycloak-js in a Vue.js application. I installed keycloak.js version 26.0.0 via Vue UI, but when I try to build the project, I get this error:

This dependency was not found:

* keycloak-js in ./src/keycloak.js

To install it, you can run: npm install --save keycloak-js

on line:

import Keycloak from "keycloak-js";

When I installed the dependency, Vue UI said it was installed successfully, but when I view the dependencies, it seems that there is some kind of issue (note the missing version and "installed" label:

bad installation

When I click the update icon on the right, it says "Dependency updated successfully", but nothing changes.

I checked package.json and yarn.lock and everything looks OK. The dependency is also present in node_modules.

I tried installing the dependency using yarn add. It says the installation was successful but the result is the same. Running yarn list keycloak-js confirms successful installation.

I also tried installing a previous version using yarn add keycloak-js@25.0.6 but that fails because some dependency requires node >= 18, and I am using 16.


Solution

  • OP solved the issue by bumping to the latest Node.js (v20/22) and VueJS (v3) versions.