nativescript-schematics icon indicating copy to clipboard operation
nativescript-schematics copied to clipboard

Error in @nativescript/schematics --sample

Open patricknee opened this issue 6 years ago • 0 comments

Environment Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

tns info:

✔ Getting NativeScript components versions information... ✔ Component nativescript has 6.2.0 version and is up to date. ✔ Component tns-core-modules has 6.2.0 version and is up to date. ✖ Component tns-android is not installed. ✖ Component tns-ios is not installed.

ng --version:

Angular CLI: 8.3.17
Node: 10.16.0
OS: darwin x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.17
@angular-devkit/build-angular     0.803.17
@angular-devkit/build-optimizer   0.803.17
@angular-devkit/build-webpack     0.803.17
@angular-devkit/core              8.3.17
@angular-devkit/schematics        8.3.17
@angular/cli                      8.3.17
@ngtools/webpack                  8.3.17
@schematics/angular               8.3.17
@schematics/update                0.803.17
rxjs                              6.4.0
typescript                        3.5.3
webpack                           4.39.2

package.json:

{
  "name": "web-mobile",
  "version": "0.0.0",
  "scripts": {
    "android": "tns run android",
    "ios": "tns run ios",
    "mobile": "tns run",
    "preview": "tns preview",
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "nativescript-angular": "~8.20.0",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "~0.1.12",
    "tns-core-modules": "~6.2.0",
    "tslib": "^1.10.0",
    "@angular/animations": "~8.2.13",
    "@angular/common": "~8.2.13",
    "@angular/compiler": "~8.2.13",
    "@angular/core": "~8.2.13",
    "@angular/forms": "~8.2.13",
    "@angular/platform-browser": "~8.2.13",
    "@angular/platform-browser-dynamic": "~8.2.13",
    "@angular/router": "~8.2.13",
    "@nativescript/schematics": "^0.7.3",
    "rxjs": "~6.4.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "nativescript-dev-webpack": "~1.3.0",
    "@nativescript/schematics": "~0.7.0",
    "@nativescript/tslint-rules": "~0.0.2",
    "@angular-devkit/build-angular": "~0.803.17",
    "@angular/cli": "~8.3.17",
    "@angular/compiler-cli": "~8.2.13",
    "@angular/language-service": "~8.2.13",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  },
  "nativescript": {
    "id": "org.nativescript.ngsample"
  }
}

Describe the bug Modifying a brand new angular cli application. Ran ng update and ng i -g nativescript before creating angular project.

barcelona.module.ts file has typo. Installed with "componentDeclarations" in the providers array at line 24 below. Changing this line to "providerDeclarations" allowed the app to run with ng serve.

` import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router';

import { componentDeclarations, providerDeclarations, routes, } from '@src/app/barcelona/barcelona.common';

@NgModule({ imports: [ CommonModule, RouterModule, RouterModule.forRoot(routes) ], exports: [ RouterModule ], declarations: [ ...componentDeclarations ], providers: [ ...componentDeclarations ] }) export class BarcelonaModule { } `

To Reproduce

ng new web-mobile cd web-mobile ng add @nativescript/schematics --sample Add barcelona.module.ts to app.module.ts.

navigate to http://localhost:4200/players . <- has console error.

Expected behavior

App should show list of players.

@src/app/barcelona/barcelona.module.ts file should include the following array at line 24:

  providers: [
    ...providerDeclarations
  ]

Sample project

https://github.com/patricknee/ang-ns.git

Additional context Easy manual fix in the meantime: change line 24 to providerDeclarations.

patricknee avatar Nov 06 '19 14:11 patricknee