Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR] An error occurred while running subprocess ng. #2

Open
marcialwushu opened this issue Sep 18, 2019 · 7 comments
Open

[ERROR] An error occurred while running subprocess ng. #2

marcialwushu opened this issue Sep 18, 2019 · 7 comments

Comments

@marcialwushu
Copy link
Owner

ERROR in src/app/home/home.page.ts:11:4 - error TS2554: Expected 2 arguments, but got 1.

11   @ViewChild('map') mapElement: any;
      ~~~~~~~~~~~~~~~~

  node_modules/@angular/core/core.d.ts:8436:47
    8436     (selector: Type<any> | Function | string, opts: {
                                                       ~~~~~~~
    8437         read?: any;
         ~~~~~~~~~~~~~~~~~~~
    8438         static: boolean;
         ~~~~~~~~~~~~~~~~~~~~~~~~
    8439     }): any;
         ~~~~~
    An argument for 'opts' was not provided.

[ERROR] An error occurred while running subprocess ng.

        ng.cmd run app:ionic-cordova-build --platform=browser exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
@marcialwushu
Copy link
Owner Author

(alias) ViewChild(selector: string | Function | Type<any>, opts: {
    read?: any;
    static: boolean;
}): any
import ViewChild
Expected 2 arguments, but got 1.ts(2554)
core.d.ts(8436, 47): An argument for 'opts' was not provided.

Expected 2 arguments, but got 1.ts(2554)
core.d.ts(8436, 47): An argument for 'opts' was not provided.

export declare const ViewChild: ViewChildDecorator;

/**
 * Type of the ViewChild decorator / constructor function.
 *
 * @see `ViewChild`.
 * @publicApi
 */
export declare interface ViewChildDecorator {
    /**
     * @description
     * Property decorator that configures a view query.
     * The change detector looks for the first element or the directive matching the selector
     * in the view DOM. If the view DOM changes, and a new child matches the selector,
     * the property is updated.
     *
     * View queries are set before the `ngAfterViewInit` callback is called.
     *
     * **Metadata Properties**:
     *
     * * **selector** - The directive type or the name used for querying.
     * * **read** - True to read a different token from the queried elements.
     * * **static** - True to resolve query results before change detection runs
     *
     * When `static` is not provided, uses query results to determine the timing of query
     * resolution. If any query results are inside a nested view (such as `*ngIf`), the query is
     * resolved after change detection runs. Otherwise, it is resolved before change detection
     * runs.
     *
     * The following selectors are supported.
     *   * Any class with the `@Component` or `@Directive` decorator
     *   * A template reference variable as a string (e.g. query `<my-component #cmp></my-component>`
     * with `@ViewChild('cmp')`)
     *   * Any provider defined in the child component tree of the current component (e.g.
     * `@ViewChild(SomeService) someService: SomeService`)
     *   * Any provider defined through a string token (e.g. `@ViewChild('someToken') someTokenVal:
     * any`)
     *   * A `TemplateRef` (e.g. query `<ng-template></ng-template>` with `@ViewChild(TemplateRef)
     * template;`)
     *
     * @usageNotes
     *
     * {@example core/di/ts/viewChild/view_child_example.ts region='Component'
     * linenums="false"}
     *
     * ### Example 2
     *
     * {@example core/di/ts/viewChild/view_child_howto.ts region='HowTo'
     * linenums="false"}
     *
     * @Annotation
     */
    (selector: Type<any> | Function | string, opts: {
        read?: any;
        static: boolean;
    }): any;
    new (selector: Type<any> | Function | string, opts: {
        read?: any;
        static: boolean;
    }): ViewChild;
}

@marcialwushu
Copy link
Owner Author

Ionic:

   Ionic CLI                     : 5.2.6 (C:\Users\cleilsonpereira\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.8.1
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.0.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : not installed
   native-run  : 0.2.8

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

@marcialwushu
Copy link
Owner Author

marcialwushu commented Sep 18, 2019

npm cordova run browser --verbose

ionic:lib Terminal info: { ci: false, shell: 'C:\\WINDOWS\\system32\\cmd.exe', tty: true, windows: true } +0ms
  ionic:lib CLI global options: { _: [ 'cordova', 'run', 'browser' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +5ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp\\ionic.config.json', errors: [], context: 'app', type: 'angular' } +1ms
  ionic Context: { binPath: 'C:\\Users\\cleilsonpereira\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\cleilsonpereira\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp', version: '5.2.6' } +0ms
 Creating .\www directory for you - done!
  ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp\\config.xml', package.json: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp\\package.json') +0ms
[WARN] browser is not supported by native-run. Using Cordova to run the app.
  ionic:lib:integrations:cordova:config Loading Cordova Config (config.xml: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp\\config.xml', package.json: 'C:\\Users\\cleilsonpereira\\Documents\\Workspace\\Ionic\\ionicUberApp\\package.json') +68ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic cordova run' [ 'browser', '--verbose', '--interactive', '--color' ] +0ms
  ionic:lib:build build options: { '--': [],
  ionic:lib:build   engine: 'cordova',
  ionic:lib:build   platform: 'browser',
  ionic:lib:build   project: undefined,
  ionic:lib:build   verbose: false,
  ionic:lib:build   configuration: undefined,
  ionic:lib:build   sourcemaps: undefined,
  ionic:lib:build   cordovaAssets: true,
  ionic:lib:build   type: 'angular' } +0ms
  ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:lib:build Looking for ionic:build npm script. +8ms
> ng.cmd run app:ionic-cordova-build --platform=browser
  ng:analytics getGlobalAnalytics +0ms
  ng:analytics Client Analytics config found: false +63ms
  ng:analytics Analytics disabled. Ignoring all analytics. +1ms
  ng:analytics getSharedAnalytics +1ms

chunk {cordova} cordova.js, cordova.js.map (cordova) 50.6 kB [entry] [rendered]
chunk {main} main-es2015.js, main-es2015.js.map (main) 661 bytes [initial] [rendered]
chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 149 kB [initial] [rendered]
chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.09 kB [entry] [rendered]
chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 108 kB [initial] [rendered]
Date: 2019-09-18T16:10:14.862Z - Hash: b66a3c5fe1c10077469b - Time: 11962ms

ERROR in src/app/home/home.page.ts:11:4 - error TS2554: Expected 2 arguments, but got 1.

11   @ViewChild('map') mapElement: any;
      ~~~~~~~~~~~~~~~~

  node_modules/@angular/core/core.d.ts:8436:47
    8436     (selector: Type<any> | Function | string, opts: {
                                                       ~~~~~~~
    8437         read?: any;
         ~~~~~~~~~~~~~~~~~~~
    8438         static: boolean;
         ~~~~~~~~~~~~~~~~~~~~~~~~
    8439     }): any;
         ~~~~~
    An argument for 'opts' was not provided.

[ERROR] An error occurred while running subprocess ng.

        ng.cmd run app:ionic-cordova-build --platform=browser exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:utils-process onBeforeExit handler: 'process.exit' received +0ms
  ionic:utils-process onBeforeExit handler: running 1 functions +1ms
  ionic:utils-process error while killing process tree for 7120: { Error: Command failed: taskkill /pid 7120 /T /F
  ionic:utils-process ERRO: o processo "7120" n�o foi encontrado.
  ionic:utils-process
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:289:12)
  ionic:utils-process     at ChildProcess.emit (events.js:182:13)
  ionic:utils-process     at maybeClose (internal/child_process.js:962:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 7120 /T /F' } +232ms
  ionic:utils-process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 7120 /T /F
  ionic:utils-process ERRO: o processo "7120" n�o foi encontrado.
  ionic:utils-process
  ionic:utils-process     at ChildProcess.exithandler (child_process.js:289:12)
  ionic:utils-process     at ChildProcess.emit (events.js:182:13)
  ionic:utils-process     at maybeClose (internal/child_process.js:962:16)
  ionic:utils-process     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
  ionic:utils-process   killed: false,
  ionic:utils-process   code: 128,
  ionic:utils-process   signal: null,
  ionic:utils-process   cmd: 'taskkill /pid 7120 /T /F' } +2ms
  ionic:utils-process processExit: exiting (exit code: 1) +136ms

@marcialwushu
Copy link
Owner Author

in v8 ViewChild syntax changed CHANGELOG says

core: In Angular version 8, it's required that all @ViewChild and @ContentChild queries have a 'static' flag specifying whether the query is 'static' or 'dynamic'. The compiler previously sorted queries automatically, but in 8.0 developers are required to explicitly specify which behavior is wanted. This is a temporary requirement as part of a migration; see https://v8.angular.io/guide/static-query-migration for more details.

And I advice to use https://github.com/angular/angular/blob/master/CHANGELOG.md to update

In case of "lot ts errors", I guess you have fullTemplateTypeCheck in your tsconfig file which is fine and I recommend to add it.

Have you SFC ? Is your template inside your .ts file ? If yes I doupt you use some pipe without specify all parameters ? If it is the case you can make parameters of pipe as optional like

transform(value: any, anotherparam?): any {

Otherwise you can have some hostlistener with no needed second param which was working without fullTemplateTypeCheck:

  @HostListener('window:beforeunload', ['$event'] )

It should be

  @HostListener('window:beforeunload' )

@marcialwushu
Copy link
Owner Author

marcialwushu commented Sep 18, 2019

https://github.com/angular/angular/blob/master/CHANGELOG.md

BREAKING CHANGES

  • core: In Angular version 8, it's required that all @ViewChild and @ContentChild queries have a 'static' flag specifying whether the query is 'static' or 'dynamic'. The compiler previously sorted queries automatically, but in 8.0 developers are required to explicitly specify which behavior is wanted. This is a temporary requirement as part of a migration; see static query migration guide for more details.

@ViewChildren and @ContentChildren queries are always dynamic, and so are unaffected.

@marcialwushu
Copy link
Owner Author

Static Query Migration Guide

Before:

// query results sometimes available in `ngOnInit`, sometimes in `ngAfterViewInit` (based on template)
@ViewChild('foo') foo: ElementRef;

After:

// query results available in ngOnInit
@ViewChild('foo', {static: true}) foo: ElementRef;

OR

// query results available in ngAfterViewInit
@ViewChild('foo', {static: false}) foo: ElementRef;

@marcialwushu
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant