Karma: Karma test cases breaking in node 15.1

Created on 12 Nov 2020  路  13Comments  路  Source: karma-runner/karma

Hi Team,

I have node 15.1 and node 10.x. The same Karma with Angular 9 Tests work fine in node 10.x. But when it is used with node 15.1 we are getting the following error and the test breaks abruptly. There is no pattern other than the below error.

12 11 2020 12:19:28.046:ERROR [karma-server]: TypeError: Cannot read property 'range' of undefined
at handleRangeHeaders (\webpack-dev-middleware\lib\util.js:131:21)
at processRequest (\webpack-dev-middleware\lib\middleware.js:98:19)
at ready (\webpack-dev-middleware\lib\util.js:53:12)
at handleRequest (\webpack-dev-middleware\lib\util.js:182:5)
at \webpack-dev-middleware\lib\middleware.js:64:7
at new Promise ()
at middleware (\webpack-dev-middleware\lib\middleware.js:63:12)
at \@angular-devkit\build-angular\src\angular-cli-files\plugins\karma.js:270:13
at call (\connect\index.js:239:7)
at next (\connect\index.js:183:5)
at \karma\lib\web-server.js:24:9
at call (\connect\index.js:239:7)
at next (\connect\index.js:183:5)
at nullProxy (\karma\lib\middleware\proxy.js:80:52)
at call (\connect\index.js:239:7)
at next (\connect\index.js:183:5)

Most helpful comment

Hi @johnjbarton I am facing same problem with node v14.15.2.
17 12 2020 07:18:56.924:ERROR [karma-server]: TypeError: Cannot read property 'range' of undefined
Its working fine with our previous node v14.15.1.

Please provide us solution as soon possible.

All 13 comments

Our issues are related I think.
https://github.com/karma-runner/karma/issues/3570

Ya maybe @ekdev2 . But our tickets have a different error trace.

I use node 15.2.0, and karma 5.2.3, and I also get this error. It showed up recently.

Downgrading node to v 14.15.1 works

We only support LTS versions. Also the call stack points to webpack. Maybe add some logging to narrow down the issue.

@johnjbarton I see the same error on node 14.15.2.

Amazing, a minor Node update that broke all tests.

For those running Debian/Ubuntu, I've fixed that by uninstalling nodejs, downloading nodejs_14.15.1-deb-1nodesource1_amd64.deb from nodesource pool and installing it with sudo dpkg -i ....

If you have a problem on node v14, please open a issue. This issue is about v15 which we do not support.

Hi @johnjbarton I am facing same problem with node v14.15.2.
17 12 2020 07:18:56.924:ERROR [karma-server]: TypeError: Cannot read property 'range' of undefined
Its working fine with our previous node v14.15.1.

Please provide us solution as soon possible.

Hi @johnjbarton I am facing same problem with node v14.15.2.
17 12 2020 07:18:56.924:ERROR [karma-server]: TypeError: Cannot read property 'range' of undefined
Its working fine with our previous node v14.15.1.

Please provide us solution as soon possible.

i also get same issue docker pipeline get error in ng test command

Please do not comment on this bug unless your comment is about node 15. We don't support v15 so we don't plan to reopen this bug.

If you have a problem with v14, please open an issue.

There is a bug in node v14.15.2 that impacts webpack, #3588

Node v14 isn't supported on Apple Silicon.
Therefore, you cannot (currently) run karma on Apple Silicon machines.

Edit: Err, at least natively. If you follow the instructions here: https://stackoverflow.com/questions/64963370/error-cannot-install-in-homebrew-on-arm-processor-in-intel-default-prefix-usr, you can run Node v14 via Rosetta and karma will run just fine:

  1. Install rosetta /usr/sbin/softwareupdate --install-rosetta --agree-to-license
  2. Install brew arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  3. (Note that brew for x86_64 installs to /usr/local/ rather than /opt/homebrew when running natively on Apple Silicon).
  4. Install node: arch -x86_64 brew install node@14
  5. (In my case, with angular) install the Angular CLI: /usr/local/bin/npm i -g @angular/cli
  6. Now, run the test runner from the node 14 version: /usr/local/bin/ng test

@nvahalik I'm using an M1 mac book, and it works for me! Thanks!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonh1000 picture simonh1000  路  3Comments

anius picture anius  路  3Comments

VinishaDsouza picture VinishaDsouza  路  3Comments

schippie picture schippie  路  5Comments

jambonrose picture jambonrose  路  5Comments