Newman can't read number from variable "TypeError in test-script"

My question:
I created tests for my API under Windows10 in Postman.
The tests are running great in Postman on Windows and directly on the Linux-Server with Newman.
The only thing which is making trouble is the Newman-Test in Windows. It gives me a “TypeError in test-script”. The reason: I have a variable which I want to convert into a number, but newman can’t handle it. I tried the follwing:

  1. let limit = pm.variables.get(‘myVar’).toNumber();
    Result:

TypeError in test-script

  1. let limit = Number(pm.variables.get(‘myVar’));
    Result:

NaN

  1. let limit = parseInt(pm.variables.get(‘myVar’),10);
    Result:

NaN

  1. let limit = +pm.variables.get(‘myVar’);
    Result:

NaN

  1. let limit = Math.floor(pm.variables.get(‘myVar’));
    Result:

NaN

  1. let limit = pm.environment.get(‘myVar’);
    Result:

undefined (but I defined it in the environment to test this)

  1. let limit = 1000;
    Result:

1000

Only idea #7 works.

I really don’t understand what is going on there. I thought it could be a Newman-Bug, but it’s working great on Linux with Newman.

Does anybody has an idea?