skip to Main Content

I am getting these errors when I tried to build the Angular project

angular-errorw.log

[error] TypeError: (0 , os_1.availableParallelism) is not a function
    at Object.<anonymous> (C:UsersanikeOneDriveecommerce-project3-frontendangular-ecommercenode_modulespiscinadistsrcindex.js:37:54)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:UsersanikeOneDriveecommerce-project3-frontendangular-ecommercenode_modulespiscinadistsrcmain.js:5:33)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)

package.json

{
  "name": "angular-ecommerce",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.0.0",
    "@angular/common": "^14.0.0",
    "@angular/compiler": "^14.0.0",
    "@angular/core": "^14.0.0",
    "@angular/forms": "^14.0.0",
    "@angular/platform-browser": "^14.0.0",
    "@angular/platform-browser-dynamic": "^14.0.0",
    "@angular/router": "^14.0.0",
    "@fortawesome/fontawesome-free": "^6.5.2",
    "bootstrap": "^5.2.0",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^18.0.0",
    "@angular/cli": "^14.2.13",
    "@angular/compiler-cli": "^14.0.0",
    "@types/jasmine": "~4.0.0",
    "jasmine-core": "~4.1.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "typescript": "~4.7.2"
  }
}

I was also getting this error message on my VS Ccode

Command failed: npm i --package-lock-only --prefix C:UsersanikeAppDataLocalTempexhort_gaocBM
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree 
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! dev @angular/compiler-cli@"^14.0.0" from the root project npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler-cli@"^18.0.0" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^18.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:UsersanikeAppDataLocalnpm-cacheeresolve-report.txt for a full report.
npm ERR! A complete log of this run ...

I am learning Angular, so I am here for some help.

2

Answers


  1. I’m getting the same error, trying to build an Angular project in VS Code on Mac. Also curious for an answer.

    Login or Signup to reply.
  2. I have seen your project have package:

    ....
    "devDependencies": {
        "@angular-devkit/build-angular": "^18.0.0",
    ...
    

    it not compatible with other angular package. It using version 18, but your angular using version 14.
    you should change your version of package compatible of angular. Try to set your package to version 14

    ....
    "devDependencies": {
        "@angular-devkit/build-angular": "^14.0.0",
    ...
    

    and the error:

    ...
    [error] TypeError: (0 , os_1.availableParallelism) is not a function
    ...
    

    It may be a error of nodejs version not compatible with package read this Angular version compatibility and pick a match nodejs version for your angular project.
    Hope it help!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search