chakotha
chakotha

Reputation: 95

Nativescript Angular iOS build failing

I am trying to build run a {N} with Angular app on iOS and still have a stubborn build error that I can't find anything on through Google.

I have upgraded to node 17 whereas node 16 is the current LTS version. Could that be causing a problem?

Here is the error from

tns run ios

tns run ios
Searching for devices...
Preparing project...
webpack is watching the files...
Compiling listview-directives : main as commonjs
/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40
                throw new Error("The target entry-point \"" + invalidTarget.entryPoint.name + "\" has missing dependencies:\n" +
                ^

Error: The target entry-point "undefined" has missing dependencies:
 - nativescript-angular/element-registry

    at TargetedEntryPointFinder.findEntryPoints (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40:23)
    at /Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/execution/analyze_entry_points.js:29:41
    at SingleProcessExecutorSync.SingleProcessorExecutorBase.doExecute (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:28:29)
    at /Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:59
    at SyncLocker.lock (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/locking/sync_locker.js:34:24)
    at SingleProcessExecutorSync.execute (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/execution/single_process_executor.js:57:27)
    at Object.mainNgcc (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/main.js:74:25)
    at Object.process (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/index.js:29:23)
    at NgccProcessor.processModule (/Users/user/myprojects/node_modules/@ngtools/webpack/src/ngcc_processor.js:175:16)
    at /Users/user/myprojects/node_modules/@ngtools/webpack/src/ivy/host.js:146:18
    at /Users/user/myprojects/node_modules/@ngtools/webpack/src/ivy/host.js:76:24
    at Array.map (<anonymous>)
    at Object.host.resolveModuleNames (/Users/user/myprojects/node_modules/@ngtools/webpack/src/ivy/host.js:74:32)
    at actualResolveModuleNamesWorker (/Users/user/myprojects/node_modules/typescript/lib/typescript.js:109497:133)
    at resolveModuleNamesWorker (/Users/user/myprojects/node_modules/typescript/lib/typescript.js:109760:26)
    at resolveModuleNamesReusingOldState (/Users/user/myprojects/node_modules/typescript/lib/typescript.js:109857:24)

Node.js v17.0.1
Executing webpack failed with exit code 1.

And here is the package.json:

{
  "description": "myproject myproject App | Mobile Expense Reports",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "com.myproject.app",
    "tns-android": {
      "version": "6.5.0"
    },
    "tns-ios": {
      "version": "6.5.2"
    }
  },
  "scripts": {
    "lint": "tslint \"app/**/*.ts\""
  },
  "dependencies": {
    "@angular/animations": "8.0.0",
    "@angular/common": "8.0.0",
    "@angular/compiler": "8.0.0",
    "@angular/core": "8.0.0",
    "@angular/forms": "8.0.0",
    "@angular/http": "8.0.0-beta.10",
    "@angular/platform-browser": "8.0.0",
    "@angular/platform-browser-dynamic": "8.0.0",
    "@angular/router": "8.0.0",
    "@nativescript/core": "^6.5.8",
    "@nativescript/fingerprint-auth": "^8.0.0",
    "nativescript-angular": "^8.21.0",
    "nativescript-app-sync": "^2.0.0",
    "nativescript-bottom-navigation": "^2.0.5",
    "nativescript-camera": "^4.0.2",
    "nativescript-drop-down": "^5.0.6",
    "nativescript-fancyalert": "^3.0.9",
    "nativescript-fingerprint-auth": "^7.0.2",
    "nativescript-fontawesome": "^1.0.0",
    "nativescript-gradient": "^2.0.1",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-modal-datetimepicker": "^1.1.4",
    "nativescript-pdf-view": "^2.1.0",
    "nativescript-theme-core": "~1.0.4",
    "nativescript-toast": "^1.4.6",
    "nativescript-ui-listview": "^8.0.1",
    "node-sass": "^4.14.1",
    "reflect-metadata": "~0.1.10",
    "ruby": "^0.6.1",
    "rxjs": "^6.4.0",
    "zone.js": "^0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "8.0.0",
    "@ngtools/webpack": "8.0.0",
    "babel-traverse": "6.26.0",
    "babel-types": "6.26.0",
    "babylon": "6.18.0",
    "codelyzer": "~4.5.0",
    "extract-text-webpack-plugin": "~3.0.2",
    "lazy": "1.0.11",
    "nativescript-dev-webpack": "^1.3.0",
    "terser-webpack-plugin": "^3.0.6",
    "tslint": "~5.12.1",
    "typescript": "3.4.5",
    "uglifyjs-webpack-plugin": "^2.2.0",
    "webpack": "^4.42.0",
    "webpack-cli": "^3.3.10"
  }
}

I don't understand the error

Error: The target entry-point "undefined" has missing dependencies:

Thanks for any clues.

Upvotes: 1

Views: 259

Answers (1)

DanLatimer
DanLatimer

Reputation: 117

TLDR; you have a module in your package.json that isn't compatible with the angular version you're building.

I'm running into the same error and was able to fix it. Some module requiring a dependency but the module's name is undefined. I added some custom code to the installed node_module that was exploding to debug further to figure out which of my node modules has this missing dependency then update that module.

For example your stack trace says that this function blows up:

at TargetedEntryPointFinder.findEntryPoints (/Users/user/myprojects/node_modules/@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder.js:40:23)

So I would add some code to output to the console additional information, here's what I added to that same file:

  findEntryPoints() {
    const entryPoints = super.findEntryPoints();
    const invalidTarget = entryPoints.invalidEntryPoints.find((i) => i.entryPoint.path === this.targetPath);
    if (invalidTarget !== void 0) {
      // ADD THIS NEXT LINE
      console.log('Failed to find dependencies', entryPoints.invalidEntryPoints)
      throw new Error(`The target entry-point "${invalidTarget.entryPoint.name}" has missing dependencies:
` + invalidTarget.missingDependencies.map((dep) => ` - ${dep}
`).join(""));
    }
    return entryPoints;
  }

Then run the build again (without npm install as that would clear your changes)

Upvotes: 0

Related Questions