DS18B20 and NodeMCU

Hi,
I'm new to the forum. I've been working with Uno and nano for a little while, but just got a NodeMCU (ESP-12E) and am programming it with the Arduino IDE.
The module reads analogue data and sends it to thingspeak without problem. However when I try and add a DS18B20 onewire sensor to a digital pin I get an error I don't understand when compiling.
The error is:
In file included from C:\Users\Al\OneDrive\Arduino\ESP8266_DS18B20_temperature_sensor_REST\ESP8266_DS18B20_temperature_sensor_REST.ino:16:0:

C:\Program Files (x86)\Arduino\libraries\OneWire/OneWire.h:108:2: error: #error "Please define I/O register types here"

#error "Please define I/O register types here"
I got this code from the web and have stripped out all the wireless lines to try and isolate the problem. My code should now only print to screen.
Can anyone help please.
Thanks

#include <ESP8266WiFi.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 2  // DS18B20 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

float oldTemp;
void setup() {
  Serial.begin(115200);   
  oldTemp = -1;
}

void loop() {
  float temp;  
  do {
    DS18B20.requestTemperatures(); 
    temp = DS18B20.getTempCByIndex(0);
    Serial.print("Temperature: ");
    Serial.println(temp);
  } while (temp == 85.0 || temp == (-127.0));
  
  if (temp != oldTemp)
  {
    oldTemp = temp;
  }  
    delay(1000);
}

I doubt Arduino I2C libraries support non-arduino MCUs.

You need to use NodeMCU forum(s) for this sort of question I think. I suspect
they don't currently support anything fancy on Arduino IDE - the NodeMCU seems
to have libraries of its own.