NativeScript / nativescript-angular

Integrating NativeScript with Angular
http://docs.nativescript.org/angular/tutorial/ng-chapter-0
Apache License 2.0
1.21k stars 241 forks source link

Failed to find module: "nativescript-angular/platform", relative to: app/tns_modules/ #1188

Open mozi22 opened 6 years ago

mozi22 commented 6 years ago

Hi, I am unable to figure this one out. It's took me a several days without success. Please help me out.

System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: 
System.err: Error calling module function 
System.err: Error: com.tns.NativeScriptException: Failed to find module: "nativescript-angular/platform", relative to: app/tns_modules/
System.err:     com.tns.Module.resolvePathHelper(Module.java:146)
System.err:     com.tns.Module.resolvePath(Module.java:55)
System.err:     com.tns.Runtime.runModule(Native Method)
System.err:     com.tns.Runtime.runModule(Runtime.java:530)
System.err:     com.tns.Runtime.run(Runtime.java:522)
System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19)
System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1036)
System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:6316)
System.err:     android.app.ActivityThread.access$1800(ActivityThread.java:221)
System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1860)
System.err:     android.os.Handler.dispatchMessage(Handler.java:102)
System.err:     android.os.Looper.loop(Looper.java:158)
System.err:     android.app.ActivityThread.main(ActivityThread.java:7224)
System.err:     java.lang.reflect.Method.invoke(Native Method)
System.err:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

Here's how my package.json looks.

{
  "name": "angular-seed-advanced",
  "version": "0.0.0",
  "nativescript": {
    "id": "com.maxtoolbox.vrsta",
    "tns-ios": {
      "version": "3.3.0"
    },
    "tns-android": {
      "version": "3.3.1"
    }
  },
  "scripts": {
    "preinstall": "mkdirp app",
    "clean": "rimraf platforms node_modules lib hooks app && mkdirp app",
    "ns-bundle": "ns-bundle",
    "publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
    "generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
    "start-android-bundle": "npm run ns-bundle --android --run-app",
    "start-ios-bundle": "npm run ns-bundle --ios --run-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-with-webpack": "tns run android --bundle",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  },
  "dependencies": {
    "@angular/animations": "~5.2.0",
    "@angular/common": "~5.2.0",
    "@angular/compiler": "~5.2.0",
    "@angular/core": "~5.2.0",
    "@angular/forms": "~5.2.0",
    "@angular/http": "~5.2.0",
    "@angular/platform-browser": "~5.2.0",
    "@angular/router": "~5.2.0",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^2.0.3",
    "@ngrx/store": "^2.2.2",
    "@ngx-translate/core": "~7.0.0",
    "@ngx-translate/http-loader": "~0.1.0",
    "angulartics2": "^2.2.2",
    "lodash": "^4.17.4",
    "nativescript-angular": "~5.2.0",
    "nativescript-background-http": "^3.1.0",
    "nativescript-camera": "^3.1.4",
    "nativescript-checkbox": "^3.0.1",
    "nativescript-fingerprint-auth": "^5.0.0",
    "nativescript-imagepicker": "^4.0.1",
    "nativescript-iqkeyboardmanager": "^1.1.0",
    "nativescript-localstorage": "^1.1.2",
    "nativescript-mediafilepicker": "^1.0.4",
    "nativescript-pdf-view": "^2.0.1",
    "nativescript-platform-css": "^1.6.5",
    "nativescript-plugin-firebase": "^4.2.1",
    "nativescript-pro-ui": "^3.2.0",
    "nativescript-purchase": "^1.0.5",
    "enhanced-resolve": "3.3.0",
    "nativescript-theme-core": "^1.0.4",
    "nativescript-toast": "^1.4.6",
    "nativescript-videoplayer": "^3.1.0",
    "ngrx-store-freeze": "0.1.9",
    "reflect-metadata": "^0.1.8",
    "rxjs": "~5.5.2",
    "tns-core-modules": "~3.4.0",
    "zone.js": "~0.8.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~5.2.0",
    "@ngrx/store-devtools": "~3.2.4",
    "@ngtools/webpack": "1.3.1",
    "enhanced-resolve": "3.3.0",
    "@types/jasmine": "2.5.41",
    "@types/lodash": "4.14.63",
    "babel-traverse": "6.11.4",
    "babel-types": "6.11.1",
    "babylon": "6.8.4",
    "codelyzer": "^3.0.1",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~2.1.0",
    "fs-extra": "^0.30.0",
    "glob": "^7.0.5",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.0.9",
    "nativescript-dev-sass": "^1.1.1",
    "nativescript-dev-webpack": "0.9.0",
    "opener": "^1.4.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.0.2",
    "rimraf": "^2.5.3",
    "tar.gz": "^1.0.5",
    "tns-platform-declarations": "^3.0.1",
    "tslint": "^5.2.0",
    "typescript": "~2.6.2",
    "nativescript-dev-typescript": "~0.6.0",
    "webpack": "~2.5.1",
    "webpack-sources": "~0.2.3",
    "webpack-bundle-analyzer": "^2.8.2",
    "css-loader": "~0.28.7",
    "nativescript-worker-loader": "~0.8.1",
    "sass-loader": "~6.0.6"
  }
}

I am trying to bundle my project using webpack using the following command tns run android --bundle. Please help me out here.

P.S I am using the angular-seed-advanced project. But I am running the command from inside the nativescript folder of the project. Not sure if this has something to do with the error.

zeros6679 commented 6 years ago

I have a similar problem. Next error appears when I execute: tns run android. The problem started after installing "nativescript-ui-sidedrawer" plugin and removing android platform.

System.err: Error: com.tns.NativeScriptException: Failed to find module: "nativescript-angular/platform", relative to: a pp/tns_modules/ System.err: com.tns.Module.resolvePathHelper(Module.java:146) System.err: com.tns.Module.resolvePath(Module.java:55) System.err: com.tns.Runtime.runModule(Native Method) System.err: com.tns.Runtime.runModule(Runtime.java:553) System.err: com.tns.Runtime.run(Runtime.java:545) System.err: com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1032) System.err: android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876) System.err: android.app.ActivityThread.-wrap3(ActivityThread.java) System.err: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1699) System.err: android.os.Handler.dispatchMessage(Handler.java:102) System.err: android.os.Looper.loop(Looper.java:154) System.err: android.app.ActivityThread.main(ActivityThread.java:6682) System.err: java.lang.reflect.Method.invoke(Native Method) System.err: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) System.err: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) System.err: File: ", line: 1, column: 265

My package.json looks:

{ "nativescript": { "id": "org.nativescript.conFusion", "tns-ios": { "version": "5.0.0" }, "tns-android": { "version": "5.0.0" } }, "description": "NativeScript Application", "license": "SEE LICENSE IN ", "repository": "", "dependencies": { "@angular/animations": "~6.1.0", "nativescript-theme-core": "~1.0.4", "nativescript-ui-sidedrawer": "^5.0.0", "reflect-metadata": "~0.1.8" }, "devDependencies": { "@angular/common": "^6.1.10", "@angular/compiler": "^6.1.10", "@angular/compiler-cli": "~6.1.0", "@angular/core": "^6.1.10", "@angular/forms": "^6.1.10", "@angular/http": "^6.1.10", "@angular/platform-browser": "^6.1.10", "@angular/platform-browser-dynamic": "^6.1.10", "@angular/router": "^6.1.10", "@nativescript/schematics": "~0.3.0", "@ngtools/webpack": "^6.2.7", "css-loader": "^1.0.1", "extract-text-webpack-plugin": "^3.0.2", "nativescript-angular": "^6.2.0", "nativescript-dev-typescript": "~0.7.0", "nativescript-dev-webpack": "~0.17.0", "rxjs": "^6.0.0", "sass-loader": "^7.1.0", "tns-core-modules": "^5.0.2", "typescript": "^2.7.2", "webpack": "^4.0.0", "zone.js": "^0.8.26" }, "readme": "NativeScript Application" }

I removed and reinstalled hooks, platform and node modules directories but the error is still there. I don't know what could be my next step.

alihatam commented 5 years ago

I have similar problem about lodash

khoihuynhInfo commented 5 years ago

me :( Error: com.tns.NativeScriptException: Failed to find module: "@ngrx/store", relative to: app/tns_modules/