esp8266 won't connect to wifi

I bought a NodeMCU a few days ago and I want to establish a connection to my home wifi with it.
I double checked the SSID and the password I entered, but when I start the script, it just keeps pressing dots (symbolizes that it tries to make a connection, but hasn’t connected yet) and won’t connect to my wifi.

My home network is running on both 5 MHz and 2.4 MHz.
The NodeMCU seems to be working fine, as it can print to the serial monitor without any problems.
I also tried it with a second one.

Here’s the script:

#include <ESP8266WiFi.h>

const char* ssid     = "SSID"
const char* password = "PASSWORD";

void setup() {
  WiFi.begin(ssid, password);
  Serial.print("Connecting to ");
  Serial.print(ssid); Serial.println(" ...");

  int i = 0;
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(++i); Serial.print(' ');

  Serial.println("Connection established!");  
  Serial.print("IP address:\t");

I’m thankful for any help!

(not sure if this is the right area to post this, please move me when I am wrong here)

what version of esp8266 boards package did yoy install? the WiFi authentication is WEP or WPA?

I installed the newest version, 2.5.2. My router is running WPA2(CCMP).

try a sketch with WiFi.disconnect() only and then again this sketch