NativeScript / nativescript-dev-webpack

A package to help with webpacking NativeScript apps.
Apache License 2.0
97 stars 49 forks source link

ERROR in Cannot read property 'name' of undefined #249

Closed jibon57 closed 7 years ago

jibon57 commented 7 years ago

ref: https://github.com/NativeScript/nativescript-dev-webpack/issues/233#issuecomment-320952746 Error:

parseQuery() will be replaced with geHash: b902734073565f8f9a69
Version: webpack 3.2.0
Time: 8889ms
                                   Asset       Size  Chunks                    Chunk Names
            assets/icon/course/page7.png    1.14 kB          [emitted]
                               bundle.js  779 bytes       0  [emitted]         bundle
                               vendor.js    3.02 MB       2  [emitted]  [big]  vendor
                                 app.css    17.4 kB       1  [emitted]         app.css
                 fonts/RobotoRegular.ttf     126 kB          [emitted]
           fonts/fontawesome-webfont.ttf     166 kB          [emitted]
              assets/images/slider-3.jpg     102 kB          [emitted]
              assets/images/slider-2.jpg     163 kB          [emitted]
              assets/images/slider-1.jpg     162 kB          [emitted]
                 assets/images/apple.jpg     277 kB          [emitted]  [big]
              assets/icon/about-icon.png    4.42 kB          [emitted]
           assets/icon/course-market.png    4.14 kB          [emitted]
                    assets/icon/chat.png    4.07 kB          [emitted]
         assets/icon/book-live-class.png    4.92 kB          [emitted]
          assets/icon/course/default.png       2 kB          [emitted]
assets/icon/course/bigbluebuttonbn10.png    4.12 kB          [emitted]
          assets/icon/course/dubbing.png    2.13 kB          [emitted]
         assets/icon/course/dubbing6.png    2.13 kB          [emitted]
         assets/icon/course/glossary.png    1.55 kB          [emitted]
           assets/icon/course/forum0.png    1.78 kB          [emitted]
            assets/icon/course/jibon.png    1.79 kB          [emitted]
  assets/icon/course/bigbluebuttonbn.png    4.12 kB          [emitted]
        assets/icon/course/glossary2.png    1.55 kB          [emitted]
             assets/icon/course/page.png    2.04 kB          [emitted]
           assets/icon/course/jibon1.png    1.79 kB          [emitted]
            assets/icon/course/page0.png    1.36 kB          [emitted]
            assets/icon/course/page8.png    1.73 kB          [emitted]
                              app.css.js  269 bytes       1  [emitted]         app.css
         assets/icon/course/question.png     1.9 kB          [emitted]
             assets/icon/course/quiz.png    1.95 kB          [emitted]
            assets/icon/course/quiz2.png    1.95 kB          [emitted]
            assets/icon/course/quiz3.png    2.35 kB          [emitted]
            assets/icon/course/quiz0.png    1.95 kB          [emitted]
            assets/icon/course/quiz1.png    2.35 kB          [emitted]
            assets/icon/course/quiz6.png    2.13 kB          [emitted]
            assets/icon/course/quiz5.png    2.23 kB          [emitted]
            assets/icon/course/quiz9.png       2 kB          [emitted]
            assets/icon/course/quiz4.png    1.95 kB          [emitted]
            assets/icon/course/users.png    3.93 kB          [emitted]
               assets/icon/debugging.png    3.19 kB          [emitted]
              assets/icon/flashcards.png    2.65 kB          [emitted]
            assets/icon/course/video.png    2.79 kB          [emitted]
                   assets/icon/forum.png    5.11 kB          [emitted]
             assets/icon/go-to-china.png    4.71 kB          [emitted]
              assets/icon/microphone.png    18.4 kB          [emitted]
     assets/icon/ic_action_next_item.png  727 bytes          [emitted]
 assets/icon/ic_action_previous_item.png  744 bytes          [emitted]
           assets/icon/learn-courses.png    3.62 kB          [emitted]
        assets/icon/ic_action_remove.png  536 bytes          [emitted]
                     assets/icon/mic.png    15.8 kB          [emitted]
                    assets/icon/test.png       5 kB          [emitted]
                  assets/images/logo.png     168 kB          [emitted]
                            package.json   86 bytes          [emitted]
                              starter.js   39 bytes          [emitted]
                     tns-java-classes.js    0 bytes          [emitted]
 [110] .. lazy 160 bytes {2} [built]
 [160] ./main.aot.ts 363 bytes {0} [built]
 [164] ./package.json 84 bytes {2} [optional] [built]
 [205] ./vendor.ts 484 bytes {2} [built]
 [206] ./vendor-platform.android.ts 539 bytes {2} [built]
 [257] ./app.css 41 bytes {1} [built]
 [260] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
    + 254 hidden modules

ERROR in Cannot read property 'name' of undefined

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
 @ ./main.aot.ts 4:29-62
Child app\components\home\home.html:
       1 module
Child app\components\dashboard\dashboard.html:
       1 module
Child app\components\mycourses\mycourses.html:
       1 module
Child app\components\about\about.html:
       1 module
Child app\components\blog\blog.html:
       1 module
Child app\components\blog\popup\blog.popup.html:
       1 module
Child app\components\coursebycat\coursebycat.html:
       1 module
Child app\components\coursebycat\details\coursebycatdetails.html:
       1 module
Child app\components\coursedetails\coursedetails.html:
       1 module
Child app\components\login\login.html:
       1 module
Child app\components\forum\forum.html:
       1 module
Child app\components\forum\popup\forum.popup.html:
       1 module
Child app\components\logout\logout.html:
       1 module
Child app\components\product\product.html:
       1 module
Child app\components\product\popup\product.popup.html:
       1 module
Child app\components\video\video.html:
       1 module
Child app\components\shared\menu\menu.html:
       1 module
Child app\components\coursemodules\glossary\glossary.html:
       1 module
Child app\components\coursemodules\dubbing\dubbing.html:
       1 module
Child app\components\coursemodules\jibon\jibon.html:
       1 module
Child app\components\coursemodules\page\page.html:
       1 module
Child app\components\coursemodules\quiz\quiz.html:
       1 module
Child app\components\home\home.css:
       1 module
Child app\components\dashboard\dashboard.css:
       1 module
Child app\components\blog\blog.css:
       1 module
Child app\components\mycourses\mycourses.css:
       1 module
Child app\components\coursebycat\coursebycat.css:
       1 module
Child app\components\coursebycat\details\coursebycatdetails.css:
       1 module
Child app\components\coursedetails\coursedetails.css:
       1 module
Child app\components\login\login.css:
       1 module
Child app\components\logout\logout.css:
       1 module
Child app\components\forum\popup\forum.popup.css:
       1 module
Child app\components\product\product.css:
       1 module
Child app\components\product\popup\product.popup.css:
       1 module
Child app\components\coursemodules\glossary\glossary.css:
       1 module
Child app\components\coursemodules\dubbing\dubbing.css:
       1 module
Child app\components\coursemodules\jibon\jibon.css:
       1 module
Child app\components\coursemodules\quiz\quiz.css:
       1 module
Child app\components\coursemodules\page\page.css:
       1 module
Child app\components\forum\forum.css:
       1 module
Child extract-text-webpack-plugin D:\Others\Documents\My_Work\NativeScript\node_modules\extract-text-webpack-plugin\dist D:\Others\Documents\My_Work\NativeScript\node_modules\resolve-url-loader\index.js??ref--1-1!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-css-loader\index.js??ref--1-2!D:\Others\Documents\My_Work\NativeScript\node_modules\nativescript-dev-webpack\platform-css-loader.js!D:\Others\Documents\My_Work\NativeScript\app\app.css:
       [1] ../node_modules/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null,"includeRoot":false}!../node_modules/nativescript-css-loader?{"minimize":false}!../node_modules/nativescript-dev-webpack/platform-css-loader.js!./app.css 950 bytes {0} [built]
       [3] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB {0} [built]
        + 2 hidden modules
Webpack Bundle Analyzer saved stats file to D:\Others\Documents\My_Work\NativeScript\report\stats.json
Webpack Bundle Analyzer saved report to D:\Others\Documents\My_Work\NativeScript\report\report.html
child process exited with code 2

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--run-app"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! @ start-android-bundle: `npm run ns-bundle --android --run-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-android-bundle script 'npm run ns-bundle --android --run-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run ns-bundle --android --run-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

What may be the problem?

iguissouma commented 7 years ago

According to documentation When using a custom module loader NSModuleFactoryLoader you don't use a callback to the loadChildren property like below: loadChildren: () => require("./components/about/about.module#AboutModule")

You should change all loadChildren properties in your router configuration. like below: loadChildren: "./components/about/about.module#AboutModule"

jibon57 commented 7 years ago

@iguissouma Thanks for your reply. I just make changes but getting this error:

 [260] ../node_modules/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
    + 254 hidden modules

ERROR in Cannot read property 'name' of undefined

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
 @ ./main.aot.ts 4:29-62
iguissouma commented 7 years ago

I tested on a project, it works fine. Maybe you are using Version: webpack 3.2.0

I'm using "webpack": "~2.6.1" on package.json

jibon57 commented 7 years ago

@iguissouma Thanks for reply. Yes, I am using webpack 3.2.0 but how can I use "webpack": "~2.6.1"?

npm install  webpack@2.6.1
`-- UNMET PEER DEPENDENCY webpack@2.6.1

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN extract-text-webpack-plugin@3.0.0 requires a peer of webpack@^3.1.0 but none was installed.
npm ERR! code 1

How can I install that?

jibon57 commented 7 years ago

@iguissouma Will you please share your package.json file? I want to copy & try :)

iguissouma commented 7 years ago

here my package.json:

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.mobile",
    "tns-ios": {
      "version": "3.0.1"
    },
    "tns-android": {
      "version": "3.1.1"
    }
  },
  "dependencies": {
    "@angular/common": "~4.1.3",
    "@angular/compiler": "~4.1.3",
    "@angular/core": "~4.1.3",
    "@angular/forms": "~4.1.3",
    "@angular/http": "~4.1.3",
    "@angular/platform-browser": "~4.1.3",
    "@angular/platform-browser-dynamic": "~4.1.3",
    "@angular/router": "~4.1.3",
    "apollo-angular": "^0.13.0",
    "apollo-client": "^1.7.0",
    "email-validator": "^1.0.7",
    "graphql-tag": "^1.2.4",
    "nativescript-angular": "~3.1.0",
    "nativescript-angular-snapshot": "1.4.0-5.5.372.32-1",
    "nativescript-clipboard": "^1.1.6",
    "nativescript-contacts": "^1.5.0",
    "nativescript-email": "^1.4.0",
    "nativescript-image-colors": "^1.0.3",
    "nativescript-iqkeyboardmanager": "^1.0.1",
    "nativescript-locate-address": "^1.0.0",
    "nativescript-ngx-fonticon": "^2.0.0",
    "nativescript-permissions": "^1.2.3",
    "nativescript-phone": "^1.3.0",
    "nativescript-theme-core": "~1.0.2",
    "nativescript-toasty": "^1.1.5",
    "nativescript-web-image-cache": "^4.2.0",
    "reflect-metadata": "~0.1.8",
    "rxjs": "^5.4.0",
    "tns-core-modules": "^3.1.0"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.1.3",
    "@ngtools/webpack": "~1.4.0",
    "babel-traverse": "6.23.1",
    "babel-types": "6.23.0",
    "babylon": "6.16.1",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~2.1.0",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-android-snapshot": "^0.*.*",
    "nativescript-dev-typescript": "^0.4.6",
    "nativescript-dev-webpack": "^0.6.3",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.0.2",
    "tns-core-modules": "~3.1.0",
    "typescript": "^2.3.4",
    "webpack": "~2.6.1",
    "webpack-sources": "~1.0.1",
    "zone.js": "~0.8.4"
  },
  "scripts": {
    "ns-bundle": "ns-bundle",
    "publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
    "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-ios-bundle": "npm run ns-bundle --ios --build-app"
  }
}

Make sure to delete platforms node_modules and run npm i again and npm i -g enhanced-resolve@3.3.0

jibon57 commented 7 years ago

@iguissouma Thanks again. But again got error:

> @ start-android-bundle D:\Others\Documents\My_Work\NativeScript
> npm run ns-bundle --android --run-app

> @ ns-bundle D:\Others\Documents\My_Work\NativeScript
> ns-bundle

Copying template files...
Installing  tns-android
  - Installing tns-android[       ...........] - loadRequestedDeps: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cac  / Installing tns-android[          ........] | loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\  - Installing tns-android[          ........] - loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\  \ Installing tns-android[          ........] - loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\D:\Others\Documents\My_Work\NativeScript
`-- tns-android@3.1.1

Project successfully created.
Running webpack for android...
module.js:471
    throw err;
    ^

Error: Cannot find module 'webpack-bundle-analyzer'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (D:\Others\Documents\My_Work\NativeScript\webpack.config.js:8:34)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at requireConfig (D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:96:18)
    at D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:109:17
    at Array.forEach (native)
    at module.exports (D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:107:15)
child process exited with code 1

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--run-app"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ start-android-bundle: `npm run ns-bundle --android --run-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-android-bundle script 'npm run ns-bundle --android --run-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run ns-bundle --android --run-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

So I try this:

D:\Others\Documents\My_Work\NativeScript>npm i webpack-bundle-analyzer
D:\Others\Documents\My_Work\NativeScript
`-- webpack-bundle-analyzer@2.9.0
  +-- commander@2.11.0
  +-- ejs@2.5.7
  +-- express@4.15.4
  | +-- accepts@1.3.3
  | | +-- mime-types@2.1.16
  | | | `-- mime-db@1.29.0
  | | `-- negotiator@0.6.1
  | +-- array-flatten@1.1.1
  | +-- content-disposition@0.5.2
  | +-- content-type@1.0.2
  | +-- cookie@0.3.1
  | +-- cookie-signature@1.0.6
  | +-- depd@1.1.1
  | +-- encodeurl@1.0.1
  | +-- escape-html@1.0.3
  | +-- etag@1.8.0
  | +-- finalhandler@1.0.4
  | | `-- unpipe@1.0.0
  | +-- fresh@0.5.0
  | +-- merge-descriptors@1.0.1
  | +-- methods@1.1.2
  | +-- on-finished@2.3.0
  | | `-- ee-first@1.1.1
  | +-- parseurl@1.3.1
  | +-- path-to-regexp@0.1.7
  | +-- proxy-addr@1.1.5
  | | +-- forwarded@0.1.0
  | | `-- ipaddr.js@1.4.0
  | +-- qs@6.5.0
  | +-- range-parser@1.2.0
  | +-- send@0.15.4
  | | +-- destroy@1.0.4
  | | +-- http-errors@1.6.2
  | | `-- mime@1.3.4
  | +-- serve-static@1.12.4
  | +-- setprototypeof@1.0.3
  | +-- statuses@1.3.1
  | +-- type-is@1.6.15
  | | `-- media-typer@0.3.0
  | +-- utils-merge@1.0.0
  | `-- vary@1.1.1
  +-- filesize@3.5.10
  +-- gzip-size@3.0.0
  | `-- duplexer@0.1.1
  +-- opener@1.4.3
  `-- ws@2.3.1
    +-- safe-buffer@5.0.1
    `-- ultron@1.1.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'D:\Others\Documents\My_Work\NativeScript\node_modules\node-libs-browser\package.json'

Again:


D:\Others\Documents\My_Work\NativeScript>npm run start-android-bundle

> @ start-android-bundle D:\Others\Documents\My_Work\NativeScript
> npm run ns-bundle --android --run-app

> @ ns-bundle D:\Others\Documents\My_Work\NativeScript
> ns-bundle

Running webpack for android...
 10% building modules 0/2 modules 2 active ...ts\My_Work\NativeScript\app\vendor.ts(node:14084) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with geHash: 2b244cbcab5c5c8df83c
Version: webpack 2.6.1
Time: 9459ms
                                   Asset       Size  Chunks                    Chunk Names
            assets/icon/course/page8.png    1.73 kB          [emitted]
                               bundle.js  777 bytes       0  [emitted]         bundle
                               vendor.js    3.01 MB       2  [emitted]  [big]  vendor
                                 app.css    17.4 kB       1  [emitted]         app.css
           fonts/fontawesome-webfont.ttf     166 kB          [emitted]
                 fonts/RobotoRegular.ttf     126 kB          [emitted]
                 assets/images/apple.jpg     277 kB          [emitted]  [big]
              assets/images/slider-1.jpg     162 kB          [emitted]
              assets/images/slider-3.jpg     102 kB          [emitted]
              assets/images/slider-2.jpg     163 kB          [emitted]
              assets/icon/about-icon.png    4.42 kB          [emitted]
         assets/icon/book-live-class.png    4.92 kB          [emitted]
           assets/icon/course-market.png    4.14 kB          [emitted]
                    assets/icon/chat.png    4.07 kB          [emitted]
  assets/icon/course/bigbluebuttonbn.png    4.12 kB          [emitted]
          assets/icon/course/default.png       2 kB          [emitted]
assets/icon/course/bigbluebuttonbn10.png    4.12 kB          [emitted]
         assets/icon/course/dubbing6.png    2.13 kB          [emitted]
          assets/icon/course/dubbing.png    2.13 kB          [emitted]
           assets/icon/course/forum0.png    1.78 kB          [emitted]
         assets/icon/course/glossary.png    1.55 kB          [emitted]
        assets/icon/course/glossary2.png    1.55 kB          [emitted]
             assets/icon/course/page.png    2.04 kB          [emitted]
            assets/icon/course/jibon.png    1.79 kB          [emitted]
           assets/icon/course/jibon1.png    1.79 kB          [emitted]
            assets/icon/course/page0.png    1.36 kB          [emitted]
            assets/icon/course/page7.png    1.14 kB          [emitted]
                              app.css.js  267 bytes       1  [emitted]         app.css
             assets/icon/course/quiz.png    1.95 kB          [emitted]
            assets/icon/course/quiz0.png    1.95 kB          [emitted]
         assets/icon/course/question.png     1.9 kB          [emitted]
            assets/icon/course/quiz1.png    2.35 kB          [emitted]
            assets/icon/course/quiz4.png    1.95 kB          [emitted]
            assets/icon/course/quiz3.png    2.35 kB          [emitted]
            assets/icon/course/quiz2.png    1.95 kB          [emitted]
            assets/icon/course/users.png    3.93 kB          [emitted]
            assets/icon/course/quiz9.png       2 kB          [emitted]
            assets/icon/course/quiz6.png    2.13 kB          [emitted]
            assets/icon/course/quiz5.png    2.23 kB          [emitted]
            assets/icon/course/video.png    2.79 kB          [emitted]
                   assets/icon/forum.png    5.11 kB          [emitted]
               assets/icon/debugging.png    3.19 kB          [emitted]
              assets/icon/flashcards.png    2.65 kB          [emitted]
        assets/icon/ic_action_remove.png  536 bytes          [emitted]
     assets/icon/ic_action_next_item.png  727 bytes          [emitted]
 assets/icon/ic_action_previous_item.png  744 bytes          [emitted]
           assets/icon/learn-courses.png    3.62 kB          [emitted]
             assets/icon/go-to-china.png    4.71 kB          [emitted]
              assets/icon/microphone.png    18.4 kB          [emitted]
                     assets/icon/mic.png    15.8 kB          [emitted]
                    assets/icon/test.png       5 kB          [emitted]
                  assets/images/logo.png     168 kB          [emitted]
                            package.json   86 bytes          [emitted]
                              starter.js   41 bytes          [emitted]
                     tns-java-classes.js    0 bytes          [emitted]
   [1] ../~/@angular/core/@angular/core.es5.js 468 kB {2} [built]
  [17] ../~/@angular/forms/@angular/forms.es5.js 203 kB {2} [built]
  [19] ../~/@angular/common/@angular/common.es5.js 130 kB {2} [built]
  [20] ../~/@angular/router/@angular/router.es5.js 211 kB {2} [built]
  [31] ../~/@angular/platform-browser/@angular/platform-browser.es5.js 142 kB {2} [built]
 [160] ../~/@angular/http/@angular/http.es5.js 74.7 kB {2} [built]
 [161] ../~/nativescript-angular/forms.js 1.52 kB {2} [built]
 [162] ../~/nativescript-angular/router.js 3.18 kB {2} [built]
 [163] ./vendor-platform.android.ts 460 bytes {2} [built]
 [165] ./app.css 41 bytes {1} [built]
 [176] ./main.aot.ts 363 bytes {0} [built]
 [177] ./vendor.ts 405 bytes {2} [built]
 [258] ../~/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
 [259] ../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-theme-core/css/core.light.android.css 13.9 kB [built]
 [260] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 246 hidden modules

ERROR in Cannot read property 'name' of undefined

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
 @ ./main.aot.ts 4:29-62
Child app\components\home\home.html:
        + 1 hidden modules
Child app\components\mycourses\mycourses.html:
        + 1 hidden modules
Child app\components\dashboard\dashboard.html:
        + 1 hidden modules
Child app\components\about\about.html:
        + 1 hidden modules
Child app\components\blog\blog.html:
        + 1 hidden modules
Child app\components\blog\popup\blog.popup.html:
        + 1 hidden modules
Child app\components\coursebycat\coursebycat.html:
        + 1 hidden modules
Child app\components\coursebycat\details\coursebycatdetails.html:
        + 1 hidden modules
Child app\components\coursedetails\coursedetails.html:
        + 1 hidden modules
Child app\components\forum\popup\forum.popup.html:
        + 1 hidden modules
Child app\components\forum\forum.html:
        + 1 hidden modules
Child app\components\login\login.html:
        + 1 hidden modules
Child app\components\logout\logout.html:
        + 1 hidden modules
Child app\components\product\product.html:
        + 1 hidden modules
Child app\components\product\popup\product.popup.html:
        + 1 hidden modules
Child app\components\video\video.html:
        + 1 hidden modules
Child app\components\shared\menu\menu.html:
        + 1 hidden modules
Child app\components\coursemodules\dubbing\dubbing.html:
        + 1 hidden modules
Child app\components\coursemodules\jibon\jibon.html:
        + 1 hidden modules
Child app\components\coursemodules\glossary\glossary.html:
        + 1 hidden modules
Child app\components\coursemodules\page\page.html:
        + 1 hidden modules
Child app\components\coursemodules\quiz\quiz.html:
        + 1 hidden modules
Child app\components\home\home.css:
        + 1 hidden modules
Child app\components\mycourses\mycourses.css:
        + 1 hidden modules
Child app\components\dashboard\dashboard.css:
        + 1 hidden modules
Child app\components\blog\blog.css:
        + 1 hidden modules
Child app\components\coursebycat\coursebycat.css:
        + 1 hidden modules
Child app\components\coursebycat\details\coursebycatdetails.css:
        + 1 hidden modules
Child app\components\coursedetails\coursedetails.css:
        + 1 hidden modules
Child app\components\forum\popup\forum.popup.css:
        + 1 hidden modules
Child app\components\forum\forum.css:
        + 1 hidden modules
Child app\components\login\login.css:
        + 1 hidden modules
Child app\components\logout\logout.css:
        + 1 hidden modules
Child app\components\product\product.css:
        + 1 hidden modules
Child app\components\product\popup\product.popup.css:
        + 1 hidden modules
Child app\components\coursemodules\dubbing\dubbing.css:
        + 1 hidden modules
Child app\components\coursemodules\jibon\jibon.css:
        + 1 hidden modules
Child app\components\coursemodules\glossary\glossary.css:
        + 1 hidden modules
Child app\components\coursemodules\quiz\quiz.css:
        + 1 hidden modules
Child app\components\coursemodules\page\page.css:
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [0] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB {0} [built]
       [1] ../~/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB {0} [built]
       [2] ../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-theme-core/css/core.light.android.css 13.9 kB {0} [built]
       [3] ../~/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null}!../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css 950 bytes {0} [built]
Webpack Bundle Analyzer saved stats file to D:\Others\Documents\My_Work\NativeScript\report\stats.json
Webpack Bundle Analyzer saved report to D:\Others\Documents\My_Work\NativeScript\report\report.html
child process exited with code 2

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--run-app"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ start-android-bundle: `npm run ns-bundle --android --run-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-android-bundle script 'npm run ns-bundle --android --run-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run ns-bundle --android --run-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

I don't know if I am following you correctly or not :(

iguissouma commented 7 years ago

Sorry, but I can't reproduce the problem, and there's no indication where the name property is called so we can investigate more. Can you share about.module.ts and routes for this module?

jibon57 commented 7 years ago

@iguissouma Thanks for giving time for solving my problem. If you want I can send you the full app directory by email.

Here is the about.module.ts:

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { SIDEDRAWER_DIRECTIVES } from "nativescript-telerik-ui/sidedrawer/angular";

import { AboutComponent } from "./about";

export const routes = [
  {
    path: "",
    component: AboutComponent
  }
];

@NgModule({
  imports: [
    NativeScriptModule,
    NativeScriptRouterModule,
    NativeScriptRouterModule.forChild(routes),
  ],
  schemas: [NO_ERRORS_SCHEMA],
  declarations: [AboutComponent],
})
export class AboutModule { }
iguissouma commented 7 years ago

Send me the full directory containing package.json, tsconfig.json... issam.guissouma@laposte.net You can exclude platforms and node_modules

jibon57 commented 7 years ago

@iguissouma Thank you. I have sent you an email. I saw that I haven't import "NO_ERRORS_SCHEMA" in some of the child module. So, I have added it in where it was missing. Now getting this error:

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
 @ ./main.aot.ts 4:29-62

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\forum\forum.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\product\product.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\blog\blog.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\about\about.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\logout\logout.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\login\login.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursedetails\coursedetails.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursemodules\glossary\glossary.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursemodules\jibon\jibon.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursemodules\page\page.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursemodules\dubbing\dubbing.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursemodules\quiz\quiz.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursebycat\coursebycat.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts

ERROR in .. lazy
Module not found: Error: Can't resolve 'D:\Others\Documents\My_Work\NativeScript\app\components\coursebycat\details\coursebycatdetails.module.ngfactory.ts' in 'D:\Others\Documents\My_Work\NativeScript'
 @ .. lazy
 @ ../~/@angular/core/@angular/core.es5.js
 @ ./vendor.ts
iguissouma commented 7 years ago

I had same errors, but I was able to compile with success your project using webpack: see outputs below and modules splitted into chunks(0.js, 1.js ....)


Running webpack for android...
 10% building modules 0/2 modules 2 active ...nts\lab\SN_NativeScript\app\vendor.ts(node:8872) DeprecationWarning: loaderUtils.parseQuery() received a non-string value w
hich can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utHash: 5bff391879d3aed77747
Version: webpack 2.6.1
Time: 30548ms
                                   Asset       Size  Chunks                    Chunk Names
           assets/icon/course/forum0.png    1.78 kB          [emitted]
                                    0.js     178 kB       0  [emitted]
                                    2.js     182 kB       2  [emitted]
                                    3.js     141 kB       3  [emitted]
                                    4.js     236 kB       4  [emitted]
                                    5.js     237 kB       5  [emitted]
                                    6.js     143 kB       6  [emitted]
                                    7.js     140 kB       7  [emitted]
                                    8.js     133 kB       8  [emitted]
                                    9.js     161 kB       9  [emitted]
                                   10.js      98 kB      10  [emitted]
                                   11.js    99.1 kB      11  [emitted]
                                   12.js     108 kB      12  [emitted]
                                   13.js    34.5 kB      13  [emitted]
                               bundle.js     432 kB      14  [emitted]  [big]  bundle
                              app.css.js  268 bytes      15  [emitted]         app.css
                               vendor.js    3.01 MB      16  [emitted]  [big]  vendor
                                 app.css    17.4 kB      15  [emitted]         app.css
           fonts/fontawesome-webfont.ttf     166 kB          [emitted]
                 fonts/RobotoRegular.ttf     126 kB          [emitted]
                 assets/images/apple.jpg     277 kB          [emitted]  [big]
              assets/images/slider-1.jpg     162 kB          [emitted]
              assets/images/slider-2.jpg     163 kB          [emitted]
              assets/images/slider-3.jpg     102 kB          [emitted]
              assets/icon/about-icon.png    4.42 kB          [emitted]
                    assets/icon/chat.png    4.07 kB          [emitted]
           assets/icon/course-market.png    4.14 kB          [emitted]
         assets/icon/book-live-class.png    4.92 kB          [emitted]
  assets/icon/course/bigbluebuttonbn.png    4.12 kB          [emitted]
          assets/icon/course/default.png       2 kB          [emitted]
assets/icon/course/bigbluebuttonbn10.png    4.12 kB          [emitted]
          assets/icon/course/dubbing.png    2.13 kB          [emitted]
         assets/icon/course/dubbing6.png    2.13 kB          [emitted]
         assets/icon/course/glossary.png    1.55 kB          [emitted]
                                    1.js     204 kB       1  [emitted]
            assets/icon/course/jibon.png    1.79 kB          [emitted]
           assets/icon/course/jibon1.png    1.79 kB          [emitted]
             assets/icon/course/page.png    2.04 kB          [emitted]
        assets/icon/course/glossary2.png    1.55 kB          [emitted]
            assets/icon/course/page7.png    1.14 kB          [emitted]
            assets/icon/course/page0.png    1.36 kB          [emitted]
            assets/icon/course/page8.png    1.73 kB          [emitted]
         assets/icon/course/question.png     1.9 kB          [emitted]
            assets/icon/course/quiz0.png    1.95 kB          [emitted]
             assets/icon/course/quiz.png    1.95 kB          [emitted]
            assets/icon/course/quiz1.png    2.35 kB          [emitted]
            assets/icon/course/quiz2.png    1.95 kB          [emitted]
            assets/icon/course/quiz4.png    1.95 kB          [emitted]
            assets/icon/course/quiz5.png    2.23 kB          [emitted]
            assets/icon/course/quiz6.png    2.13 kB          [emitted]
            assets/icon/course/quiz3.png    2.35 kB          [emitted]
            assets/icon/course/users.png    3.93 kB          [emitted]
            assets/icon/course/quiz9.png       2 kB          [emitted]
              assets/icon/flashcards.png    2.65 kB          [emitted]
               assets/icon/debugging.png    3.19 kB          [emitted]
                   assets/icon/forum.png    5.11 kB          [emitted]
            assets/icon/course/video.png    2.79 kB          [emitted]
             assets/icon/go-to-china.png    4.71 kB          [emitted]
     assets/icon/ic_action_next_item.png  727 bytes          [emitted]
 assets/icon/ic_action_previous_item.png  744 bytes          [emitted]
           assets/icon/learn-courses.png    3.62 kB          [emitted]
        assets/icon/ic_action_remove.png  536 bytes          [emitted]
                     assets/icon/mic.png    15.8 kB          [emitted]
              assets/icon/microphone.png    18.4 kB          [emitted]
                    assets/icon/test.png       5 kB          [emitted]
                  assets/images/logo.png     168 kB          [emitted]
                            package.json   86 bytes          [emitted]
                              starter.js   41 bytes          [emitted]
                     tns-java-classes.js    0 bytes          [emitted]
   [1] ../~/@angular/core/@angular/core.es5.js 468 kB {16} [built]
   [9] ../~/@angular/router/@angular/router.es5.js 211 kB {16} [built]
  [13] ../~/@angular/common/@angular/common.es5.js 130 kB {16} [built]
  [14] ../~/@angular/forms/@angular/forms.es5.js 203 kB {16} [built]
  [25] ../~/@angular/http/@angular/http.es5.js 74.7 kB {16} [built]
  [27] ../~/nativescript-angular/router.js 3.18 kB {16} [built]
 [101] ../~/nativescript-angular/forms.js 1.52 kB {16} [built]
 [193] ./app.module.ngfactory.ts 31 kB {14} [built]
 [194] ./vendor-platform.android.ts 460 bytes {16} [built]
 [213] ./app.css 41 bytes {15} [built]
 [229] ./main.aot.ts 363 bytes {14} [built]
 [231] ./vendor.ts 405 bytes {16} [built]
 [405] ../~/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB [built]
 [406] ../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-theme-core/css/core.light.android.css 13.9 kB [built]
 [407] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 393 hidden modules
Child app\components\home\home.html:
        + 1 hidden modules
Child app\components\dashboard\dashboard.html:
        + 1 hidden modules
Child app\components\mycourses\mycourses.html:
        + 1 hidden modules
Child app\components\about\about.html:
        + 1 hidden modules
Child app\components\blog\blog.html:
        + 1 hidden modules
Child app\components\blog\popup\blog.popup.html:
        + 1 hidden modules
Child app\components\forum\forum.html:
        + 1 hidden modules
Child app\components\forum\popup\forum.popup.html:
        + 1 hidden modules
Child app\components\product\product.html:
        + 1 hidden modules
Child app\components\product\popup\product.popup.html:
        + 1 hidden modules
Child app\components\login\login.html:
        + 1 hidden modules
Child app\components\logout\logout.html:
        + 1 hidden modules
Child app\components\coursedetails\coursedetails.html:
        + 1 hidden modules
Child app\components\coursebycat\coursebycat.html:
        + 1 hidden modules
Child app\components\coursebycat\details\coursebycatdetails.html:
        + 1 hidden modules
Child app\components\shared\menu\menu.html:
        + 1 hidden modules
Child app\components\coursemodules\page\page.html:
        + 1 hidden modules
Child app\components\coursemodules\glossary\glossary.html:
        + 1 hidden modules
Child app\components\coursemodules\jibon\jibon.html:
        + 1 hidden modules
Child app\components\coursemodules\dubbing\dubbing.html:
        + 1 hidden modules
Child app\components\coursemodules\quiz\quiz.html:
        + 1 hidden modules
Child app\components\home\home.css:
        + 1 hidden modules
Child app\components\dashboard\dashboard.css:
        + 1 hidden modules
Child app\components\mycourses\mycourses.css:
        + 1 hidden modules
Child app\components\blog\blog.css:
        + 1 hidden modules
Child app\components\forum\popup\forum.popup.css:
        + 1 hidden modules
Child app\components\forum\forum.css:
        + 1 hidden modules
Child app\components\product\product.css:
        + 1 hidden modules
Child app\components\login\login.css:
        + 1 hidden modules
Child app\components\product\popup\product.popup.css:
        + 1 hidden modules
Child app\components\logout\logout.css:
        + 1 hidden modules
Child app\components\coursedetails\coursedetails.css:
        + 1 hidden modules
Child app\components\coursebycat\coursebycat.css:
        + 1 hidden modules
Child app\components\coursebycat\details\coursebycatdetails.css:
        + 1 hidden modules
Child app\components\coursemodules\page\page.css:
        + 1 hidden modules
Child app\components\coursemodules\jibon\jibon.css:
        + 1 hidden modules
Child app\components\coursemodules\glossary\glossary.css:
        + 1 hidden modules
Child app\components\coursemodules\dubbing\dubbing.css:
        + 1 hidden modules
Child app\components\coursemodules\quiz\quiz.css:
        + 1 hidden modules
Child extract-text-webpack-plugin:
       [0] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB {0} [built]
       [1] ../~/nativescript-css-loader?{"minimize":false}!./assets/css/custom.css 3.62 kB {0} [built]
       [2] ../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-theme-core/css/core.light.android.css 13.9 kB {0} [built]
       [3] ../~/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null}!../~/nativescript-css-load
er?{"minimize":false}!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css 950 bytes {0} [built]
Webpack Bundle Analyzer saved stats file to C:\dev\clients\lab\SN_NativeScript\report\stats.json
Webpack Bundle Analyzer saved report to C:\dev\clients\lab\SN_NativeScript\report\report.html
Running tns build...
Executing before-prepare hook from C:\dev\clients\lab\SN_NativeScript\hooks\before-prepare\nativescript-dev-android-snapshot.js
Executing before-prepare hook from C:\dev\clients\lab\SN_NativeScript\hooks\before-prepare\nativescript-dev-typescript.js
Preparing project...
Starting a Gradle Daemon (subsequent builds will be faster)
> Configuring > 0/3 projects > root project
 :config phase:  createDefaultIncludeFiles
> Configuring > 0/3 projects > root project
 :config phase:  addAarDependencies
        +adding dependency: C:\dev\clients\lab\SN_NativeScript\platforms\android\libs\aar\Common-2017.1.504-dev-release.aar
        +adding dependency: C:\dev\clients\lab\SN_NativeScript\platforms\android\libs\aar\Data-2017.1.504-dev-release.aar
        +adding dependency: C:\dev\clients\lab\SN_NativeScript\platforms\android\libs\aar\List-2017.1.504-dev-release.aar
        +adding dependency: C:\dev\clients\lab\SN_NativeScript\platforms\android\libs\aar\Primitives-2017.1.504-dev-release.aar
        +adding dependency: C:\dev\clients\lab\SN_NativeScript\platforms\android\libs\aar\widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_bha67nv12b0sqx98e0jl4mp7i.run(C:\dev\clients\lab\SN_NativeScript\platforms\android\build-tools\android-static-binding-generator\build.gradle:126)
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:deleteGeneratedBindings UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 17.738 secs
Successfully prepared plugin nativescript-advanced-webview for android.
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-audio for android.
Successfully prepared plugin nativescript-cardview for android.
Successfully prepared plugin nativescript-drop-down for android.
Successfully prepared plugin nativescript-exoplayer for android.
Successfully prepared plugin nativescript-fancyalert for android.
Successfully prepared plugin nativescript-gif for android.
Successfully prepared plugin nativescript-image-cache for android.
Successfully prepared plugin nativescript-loading-indicator for android.
Successfully prepared plugin nativescript-localstorage for android.
Successfully prepared plugin nativescript-ngx-slides for android.
Successfully prepared plugin nativescript-paypal for android.
Successfully prepared plugin nativescript-permissions for android.
Successfully prepared plugin nativescript-pulltorefresh for android.
Successfully prepared plugin nativescript-sqlite for android.
Successfully prepared plugin nativescript-telerik-ui for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared (android)
Executing after-prepare hook from C:\dev\clients\lab\SN_NativeScript\hooks\after-prepare\nativescript-dev-android-snapshot.js
Building project...

Change your tsconfig.aot.json like this:

{
  "extends": "./tsconfig",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "application": ["node_modules/tns-core-modules/application"],
      "application-settings": ["node_modules/tns-core-modules/application-settings"],
      "camera": ["node_modules/tns-core-modules/camera"],
      "color": ["node_modules/tns-core-modules/color"],
      "connectivity": ["node_modules/tns-core-modules/connectivity"],
      "console": ["node_modules/tns-core-modules/console"],
      "data/*": ["node_modules/tns-core-modules/data/*"],
      "fetch": ["node_modules/tns-core-modules/fetch"],
      "file-system": ["node_modules/tns-core-modules/file-system"],
      "fps-meter": ["node_modules/tns-core-modules/fps-meter"],
      "globals": ["node_modules/tns-core-modules/globals"],
      "http": ["node_modules/tns-core-modules/http"],
      "image-asset": ["node_modules/tns-core-modules/image-asset"],
      "image-source": ["node_modules/tns-core-modules/image-source"],
      "location": ["node_modules/tns-core-modules/location"],
      "platform": ["node_modules/tns-core-modules/platform"],
      "text": ["node_modules/tns-core-modules/text"],
      "timer": ["node_modules/tns-core-modules/timer"],
      "trace": ["node_modules/tns-core-modules/trace"],
      "ui/*": ["node_modules/tns-core-modules/ui/*"],
      "utils/*": ["node_modules/tns-core-modules/utils/*"],
      "xhr": ["node_modules/tns-core-modules/xhr"],
      "xml": ["node_modules/tns-core-modules/xml"]
    },
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules",
    "platforms"
  ],
  "angularCompilerOptions": {
    "skipMetadataEmit": true,
    "genDir": "./"
  },
  "files":[
    "./app/main.ts",
    "./app/components/about/about.module.ts",
    "./app/components/blog/blog.module.ts",
    "./app/components/forum/forum.module.ts",
    "./app/components/product/product.module.ts",
    "./app/components/login/login.module.ts",
    "./app/components/logout/logout.module.ts",
    "./app/components/coursedetails/coursedetails.module.ts",
    "./app/components/coursemodules/page/page.module.ts",
    "./app/components/coursemodules/glossary/glossary.module.ts",
    "./app/components/coursemodules/jibon/jibon.module.ts",
    "./app/components/coursemodules/dubbing/dubbing.module.ts",
    "./app/components/coursemodules/quiz/quiz.module.ts",
    "./app/components/coursebycat/coursebycat.module.ts",
    "./app/components/coursebycat/details/coursebycatdetails.module.ts"
  ]
}

In app.module.ts I imported NSModuleFactoryLoader from 'nativescript-angular/router' and deleted the import of the local file: +++import { NSModuleFactoryLoader } from 'nativescript-angular/router'; ---import { NsModuleFactoryLoader } from "./ns-module-factory-loader";

After npm install: I run this two commands: npm i webpack-bundle-analyzer --save-dev npm i enhanced-resolve@3.3.0 npm i typescript@2.3.4

I've installed the two nativescript plugins exoplayer and paypal from npm because I don't have your local paths.

I deleted the directory hooks and replaced it from another angular {N} project(maybe it's not necessary)

the webpack compilation then worked fine, but I got an error when generating apk.

Hope this can help you.

jibon57 commented 7 years ago

@iguissouma Thank you very much. I was following your steps but getting this error. Also if possible then please send me the working file by email :)

D:\Others\Documents\My_Work\NativeScript>npm run start-android-bundle

> @ start-android-bundle D:\Others\Documents\My_Work\NativeScript
> npm run ns-bundle --android --run-app

> @ ns-bundle D:\Others\Documents\My_Work\NativeScript
> ns-bundle

Copying template files...
Installing  tns-android
  - Installing tns-android[       ...........] \ loadRequestedDeps: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cac  / Installing tns-android[          ........] / loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\  - Installing tns-android[          ........] \ loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\  \ Installing tns-android[          ........] / loadExtraneous: verb afterAdd C:\Users\Jibon\AppData\Roaming\npm-cache\D:\Others\Documents\My_Work\NativeScript
`-- tns-android@3.1.1

Project successfully created.
Running webpack for android...
D:\Others\Documents\My_Work\NativeScript\node_modules\@ngtools\webpack\src\plugin.js:67
            const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
                                                       ^

TypeError: Cannot read property 'getLineAndCharacterOfPosition' of undefined
    at AotPlugin._setupOptions (D:\Others\Documents\My_Work\NativeScript\node_modules\@ngtools\webpack\src\plugin.js:67:56)
    at new AotPlugin (D:\Others\Documents\My_Work\NativeScript\node_modules\@ngtools\webpack\src\plugin.js:26:14)
    at getPlugins (D:\Others\Documents\My_Work\NativeScript\webpack.config.js:184:9)
    at module.exports.env (D:\Others\Documents\My_Work\NativeScript\webpack.config.js:32:21)
    at requireConfig (D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:102:15)
    at D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:109:17
    at Array.forEach (native)
    at module.exports (D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\convert-argv.js:107:15)
    at Object.<anonymous> (D:\Others\Documents\My_Work\NativeScript\node_modules\webpack\bin\webpack.js:153:40)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
child process exited with code 1

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ns-bundle" "--android" "--run-app"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ ns-bundle: `ns-bundle`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ ns-bundle script 'ns-bundle'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ns-bundle
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start-android-bundle"
npm ERR! node v6.11.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ start-android-bundle: `npm run ns-bundle --android --run-app`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start-android-bundle script 'npm run ns-bundle --android --run-app'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run ns-bundle --android --run-app
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Others\Documents\My_Work\NativeScript\npm-debug.log

I have changed app.module.ts like this:

import { NgModule, NO_ERRORS_SCHEMA, NgModuleFactoryLoader } from "@angular/core";
import { NativeScriptHttpModule } from "nativescript-angular/http";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { SlidesModule } from 'nativescript-ngx-slides';
import { NativeScriptUISideDrawerModule } from "nativescript-telerik-ui/sidedrawer/angular";

import { DropDownModule } from "nativescript-drop-down/angular";

import { AppComponent } from "./app.component";
import { CommonService } from "./services/commonServices"
import { GetJoomlaServer } from "./services/getJoomlaServer"
import { GetMoodleServer } from "./services/getMoodleServer"
import { routing, RouteComponents } from './routing';
import { NSModuleFactoryLoader } from 'nativescript-angular/router';

@NgModule({
  declarations: [AppComponent, ...RouteComponents],
  bootstrap: [AppComponent],
  imports: [
    NativeScriptModule, NativeScriptRouterModule, NativeScriptHttpModule, NativeScriptUISideDrawerModule,
    routing, SlidesModule, DropDownModule
  ],
  schemas: [NO_ERRORS_SCHEMA],
  providers: [{ provide: NgModuleFactoryLoader, useClass: NsModuleFactoryLoader }, CommonService, GetJoomlaServer, GetMoodleServer]
})
export class AppModule { }

tsconfig.aot.json


{
  "extends": "./tsconfig",
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "application": ["node_modules/tns-core-modules/application"],
      "application-settings": ["node_modules/tns-core-modules/application-settings"],
      "camera": ["node_modules/tns-core-modules/camera"],
      "color": ["node_modules/tns-core-modules/color"],
      "connectivity": ["node_modules/tns-core-modules/connectivity"],
      "console": ["node_modules/tns-core-modules/console"],
      "data/*": ["node_modules/tns-core-modules/data/*"],
      "fetch": ["node_modules/tns-core-modules/fetch"],
      "file-system": ["node_modules/tns-core-modules/file-system"],
      "fps-meter": ["node_modules/tns-core-modules/fps-meter"],
      "globals": ["node_modules/tns-core-modules/globals"],
      "http": ["node_modules/tns-core-modules/http"],
      "image-asset": ["node_modules/tns-core-modules/image-asset"],
      "image-source": ["node_modules/tns-core-modules/image-source"],
      "location": ["node_modules/tns-core-modules/location"],
      "platform": ["node_modules/tns-core-modules/platform"],
      "text": ["node_modules/tns-core-modules/text"],
      "timer": ["node_modules/tns-core-modules/timer"],
      "trace": ["node_modules/tns-core-modules/trace"],
      "ui/*": ["node_modules/tns-core-modules/ui/*"],
      "utils/*": ["node_modules/tns-core-modules/utils/*"],
      "xhr": ["node_modules/tns-core-modules/xhr"],
      "xml": ["node_modules/tns-core-modules/xml"]
    },
    "skipLibCheck": true
  },
  "exclude": [
    "node_modules",
    "platforms"
  ],
  "angularCompilerOptions": {
    "skipMetadataEmit": true,
    "genDir": "./"
  },
  "files":[
    "./app/main.ts",
    "./app/components/about/about.module.ts",
    "./app/components/blog/blog.module.ts",
    "./app/components/forum/forum.module.ts",
    "./app/components/product/product.module.ts",
    "./app/components/login/login.module.ts",
    "./app/components/logout/logout.module.ts",
    "./app/components/coursedetails/coursedetails.module.ts",
    "./app/components/coursemodules/page/page.module.ts",
    "./app/components/coursemodules/glossary/glossary.module.ts",
    "./app/components/coursemodules/jibon/jibon.module.ts",
    "./app/components/coursemodules/dubbing/dubbing.module.ts",
    "./app/components/coursemodules/quiz/quiz.module.ts",
    "./app/components/coursebycat/coursebycat.module.ts",
    "./app/components/coursebycat/details/coursebycatdetails.module.ts"
  ]
jibon57 commented 7 years ago

@iguissouma , Sorry, I missed the bracket } at the end of tsconfig.aot.json file. But here the error I am getting:

ERROR in Invalid provider for NgModuleFactoryLoader in D:/Others/Documents/My_Work/NativeScript/node_modules/@angular/core/core.d.ts. useClass cannot be undefined.
           Usually it happens when:
           1. There's a circular dependency (might be caused by using index.ts (barrel) files).
           2. Class was used before it was declared. Use forwardRef in this case.

ERROR in ./main.aot.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'D:\Others\Documents\My_Work\NativeScript\app'
 @ ./main.aot.ts 4:29-62
jibon57 commented 7 years ago

@iguissouma Thank you very much !!!! It's working... My mistake was in this line:

providers: [{ provide: NgModuleFactoryLoader, useClass: NSModuleFactoryLoader }

iguissouma commented 7 years ago

Great 👍