Home > Net >  Error: spawnSync PATH/target/node/node ENOENTNGCC failed, see above
Error: spawnSync PATH/target/node/node ENOENTNGCC failed, see above

Time:08-25

I am trying to start my angular project using ./mvnw, however when the build is running ng build --configuration development

then the following error is thrown:

 Generating browser application bundles (phase: setup)...
[INFO] /home/user/Desktop/project/node_modules/@ngtools/webpack/src/ngcc_processor.js:139
[INFO]             throw new Error(errorMessage   `NGCC failed${errorMessage ? ', see above' : ''}.`);
[INFO]                   ^
[INFO] 
[INFO] Error: spawnSync /home/user/Desktop/project/target/node/node ENOENTNGCC failed, see above.
[INFO]     at NgccProcessor.process (/home/user/Desktop/project/node_modules/@ngtools/webpack/src/ngcc_processor.js:139:19)
[INFO]     at /home/user/Desktop/project/node_modules/@ngtools/webpack/src/ivy/plugin.js:143:27
[INFO]     at Hook.eval [as call] (eval at create (/home/user/Desktop/project/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:16:1)
[INFO]     at Hook.CALL_DELEGATE [as _call] (/home/user/Desktop/project/node_modules/tapable/lib/Hook.js:14:14)
[INFO]     at Compiler.newCompilation (/home/user/Desktop/project/node_modules/webpack/lib/Compiler.js:1054:30)
[INFO]     at /home/user/Desktop/project/node_modules/webpack/lib/Compiler.js:1099:29
[INFO]     at eval (eval at create (/home/user/Desktop/project/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

However when i run the same command locally without the maven wrapper then the ng build succeeds.

My dependencies in package.json:

 "dependencies": {
    "@angular/animations": "13.1.3",
    "@angular/cdk": "13.1.3",
    "@angular/common": "13.1.3",
    "@angular/compiler": "13.1.3",
    "@angular/core": "^13.1.3",
    "@angular/forms": "13.1.3",
    "@angular/localize": "13.1.3",
    "@angular/material": "13.1.3",
    "@angular/platform-browser": "13.1.3",
    "@angular/platform-browser-dynamic": "13.1.3",
    "@angular/router": "13.1.3",
    "@fortawesome/angular-fontawesome": "^0.10.1",
    "@fortawesome/fontawesome-common-types": "^6.1.1",
    "@fortawesome/fontawesome-svg-core": "^6.1.1",
    "@fortawesome/free-regular-svg-icons": "^6.1.1",
    "@fortawesome/free-solid-svg-icons": "^6.1.1",
    "@ng-bootstrap/ng-bootstrap": "11.0.0",
    "@ngqp/core": "^13.0.0",
    "@ngx-translate/core": "14.0.0",
    "@ngx-translate/http-loader": "7.0.0",
    "ajv": "^8.10.0",
    "angular-tag-cloud-module": "^13.0.0",
    "bootstrap": "4.6.1",
    "dayjs": "1.10.7",
    "emoji-toolkit": "^6.6.0",
    "katex": "^0.15.2",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "ngx-cookie-service": "^13.1.2",
    "ngx-infinite-scroll": "10.0.1",
    "ngx-markdown": "^13.0.0",
    "ngx-webstorage": "9.0.0",
    "rxjs": "^7.5.5",
    "swagger-ui-dist": "4.2.1",
    "ts-color-class": "^0.10.1",
    "tslib": "2.3.1",
    "webpack-cli": "^4.10.0",
    "zone.js": "0.11.4"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "13.0.0",
    "@angular-builders/jest": "13.0.2",
    "@angular-devkit/build-angular": "13.1.3",
    "@angular-eslint/eslint-plugin": "13.0.1",
    "@angular/cli": "13.3.8",
    "@angular/compiler-cli": "13.1.3",
    "@angular/service-worker": "13.1.3",
    "@types/chai": "4.2.14",
    "@types/chai-string": "1.4.2",
    "@types/jest": "27.4.0",
    "@types/lodash": "^4.14.178",
    "@types/mocha": "8.2.0",
    "@types/node": "16.11.21",
    "@types/selenium-webdriver": "4.0.11",
    "@typescript-eslint/eslint-plugin": "5.10.0",
    "@typescript-eslint/parser": "5.10.0",
    "browser-sync": "2.27.7",
    "browser-sync-webpack-plugin": "2.3.0",
    "chai": "4.2.0",
    "chai-as-promised": "7.1.1",
    "chai-string": "1.5.0",
    "concurrently": "7.0.0",
    "copy-webpack-plugin": "10.2.1",
    "eslint": "8.5.0",
    "eslint-config-prettier": "8.3.0",
    "eslint-webpack-plugin": "3.1.1",
    "folder-hash": "4.0.1",
    "generator-jhipster": "7.6.0",
    "husky": "7.0.4",
    "jest": "27.4.7",
    "jest-date-mock": "1.0.8",
    "jest-junit": "13.0.0",
    "jest-preset-angular": "11.0.1",
    "jest-sonar-reporter": "2.0.0",
    "lint-staged": "12.2.2",
    "merge-jsons-webpack-plugin": "2.0.1",
    "mocha": "8.2.1",
    "prettier": "^2.5.1",
    "prettier-plugin-java": "1.6.1",
    "prettier-plugin-packagejson": "2.2.15",
    "protractor": "7.0.0",
    "rimraf": "3.0.2",
    "ts-jest": "27.1.3",
    "ts-node": "9.1.1",
    "typescript": "4.5.4",
    "wait-on": "6.0.0",
    "webdriver-manager": "12.1.8",
    "webpack-bundle-analyzer": "4.5.0",
    "webpack-merge": "5.8.0",
    "webpack-notifier": "1.15.0"
  },
  "engines": {
    "node": ">=16.13.1"
  },
  "cacheDirectories": [
    "node_modules"
  ],
  "jestSonar": {
    "reportPath": "target/test-results/jest",
    "reportFile": "TESTS-results-sonar.xml"
  },
  "overrides": {
    "webpack": "5.66.0"
  }

I have tryied to set ivy compiler options to false or true and it did not work as well. Then I tried to delete or update thrid party packages but still I did not succeed in identifying the package which can not be processed. Also of course I always deleted the package-lock.json and nodemodules before rebuilding with the ./mvnw command.

Thanks in advance for your comments!

CodePudding user response:

After many hours I was finally able to solve this error. The problem was that one third party library could not handle the new angular compiler (ivy or so) and my local ng build command used an old compiler version which was not using ivy. However, to disable ivy as recommended in many other posts did not work. To solve the issue, I had to delete all third party packages in my package.json and then one by one add (and delete package-lock.json, node_moules and target just to be sure) this package again and then check if this Error: spawnSync /home/user/Desktop/project/target/node/node ENOENTNGCC failed, see above. appeared or not. In my case "katex": "^0.15.2" was the problem. Removing it solved my problems.

  • Related