8

Could anyone advise after Angular update up to 18 I got:

An unhandled exception occurred: (0 , os_1.availableParallelism) is not a function

In angular-errors.log

[error] TypeError: (0 , os_1.availableParallelism) is not a function at Object.<anonymous> (C:\Users\Zendbook\Documents\DILAU\tracker-users-web\node_modules\piscina\dist\src\index.js:37:54) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12) at Module.require (node:internal/modules/cjs/loader:1105:19) at require (node:internal/modules/cjs/helpers:103:18) at Object.<anonymous> (C:\Users\Zendbook\Documents\DILAU\tracker-users-web\node_modules\piscina\dist\src\main.js:5:33) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) How to fix ?

try to find answer in google.

2
  • Which node version are you using? Also, which command did you run that caused the error? Commented May 23, 2024 at 10:25
  • nodejs:v18.13.0, i build as npm serve Commented May 23, 2024 at 10:43

1 Answer 1

16

This is an issue with the piscina package, which is a dependency of @angular-devkit/build-angular. It only happens on older NodeJS versions, see the related GitHub issue. They have already provided a fix with piscina v4.5.1, however it didn't make Angular v18.0.x. Here are a few options how you can fix it:

  • Update to Angular >=18.1.0, where the dependency update is included
  • Update to Node >=18.19.1 (minimum for Angular v18), or better v20
  • Force piscina version 4.5.1 with an npm override
Sign up to request clarification or add additional context in comments.

3 Comments

I mean release is a big deal, right. Do not they test before they do the release. It just breaks my heart how these issues affecting all of us because of these kind of weak release mindset.
@TadeleAyelegn They perform tests with the supported versions. The issue only occurs on versions which fall out of the supported version range. Users will get warnings about this. If they ignore this warnings, why should Angular be to blame?
Yes npm and all of it's inter-dependencies make life hard, mostly because of lack of testing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.