Wednesday 7 December 2022

How do I fix dependency conflicts in npm install?

Today I was working on a front end app. I faced below error while running npm install command.


npm ERR! Conflicting peer dependency: @angular/core@6.1.10

npm ERR! node_modules/@angular/core

npm ERR!   peer @angular/core@"^6.0.3" from @angular-redux/router@9.0.0

npm ERR!   node_modules/@angular-redux/router

npm ERR!     @angular-redux/router@"^9.0.0" from the root project


Fix for Conflicting peer dependency in node.js

  • Downgrade the npm version to the previous version.
  • remove the node_modules folder.
  • remove package-lock.json.
  • please do npm install one more time to do a fresh installation of the dependency.

Saturday 12 March 2022

Detecting a active transaction in spring application

Sometimes we need to use transactions (@Transactional) in code. We use @Transactional annotation on class and method to generate transactions.

In order to troubleshoot transaction issues, it could be helpful to verify if we have an active transaction in the current method or not.

Spring has provided a class called TransactionSychronizationManager. This class has a static method that allows us to know whether we are in a transaction (active transaction or no transaction), called isActualTransactionActive().

You can call this method and print output in logs. It will be true for active transactions false otherwise.

For example :

logger.error("Transaction is active " + TransactionSynchronizationManager.isActualTransactionActive());