For me what worked was to add this in the pipeline:
environment { PATH = "C:\\Users\\your_user\\AppData\\Roaming\\npm;${env.PATH}" }