There are 2 ways to do achieve this. Example for package java-1.8.0-openjdk:
rpm -q --requires java-1.8.0-openjdk
OR using yum:
yum deplist java-1.8.0-openjdk
rpm -e --nodeps nodejs