Close all other programs which use the STLink, like ST-Link utility. I think it just can’t open the adapter.
In addition to what @manuelbl said, make sure that you follow the Nucleo user manual chapter 6.2.4 exactly.
Doube check pinout and that you removed the two jumpers on CN2, so that the STLink is not connected to the original STM32 MCU on the Nucleo board. (There’s also an “IDD” jumper there, you can pull it out to ensure the lower MCU has no power).