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

Architect-cli, running serve target results in Data path "" should NOT have additional properties(_). #18889

Closed
14 tasks
CharlieLavers opened this issue Sep 25, 2020 · 1 comment · Fixed by #18890
Assignees
Labels
area: devkit/architect freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@CharlieLavers
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • [ x ] serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: ....

This bug is a regression. It looks like it is related to the refactoring to get ready for TS 4 (a85ba99?branch=a85ba990eb9482e630ba78b6b8417edeb1499b21&diff=unified#diff-b2c222e0f78a5c4cf888115c56457e2dR87).

In particular a change to this line: https://github.com/angular/angular-cli/blame/a85ba990eb9482e630ba78b6b8417edeb1499b21/packages/angular_devkit/architect_cli/bin/architect.ts#L87

Description

A clear and concise description of the problem...

When running a serve target through the architect cli, it results in a schema validation error "Data path "" should NOT have additional properties(_)."

Tracing through the code, it looks like the validation error was caused by the build options schema.

It looks like minimalist npm library introduces an extra _ property when parsing args and those args are passed directly as build options for the serve target. In the refactor commit mentioned above, it looks like the code changed from delete argv['_'] to argv['_']=[], this looks to be the source of the problem.

I did try reverting the line back to delete and the serve worked as expected. This could affect other targets, it just manifested under the serve target for me.

🔬 Minimal Reproduction

To reproduce, create new project

> ng new cli-bug

Install architect-cli

> npm install @angular-devkit/architect-cli --save-dev

modify package.json to run architect cli instead of angular cli.

{
  "name": "cli-bug",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "architect cli-bug:serve",
    "build": "architect cli-bug:build",
    "test": "architect cli-bug:test",
    "lint": "architect cli-bug:lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~10.1.3",
    "@angular/common": "~10.1.3",
    "@angular/compiler": "~10.1.3",
    "@angular/core": "~10.1.3",
    "@angular/forms": "~10.1.3",
    "@angular/platform-browser": "~10.1.3",
    "@angular/platform-browser-dynamic": "~10.1.3",
    "@angular/router": "~10.1.3",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/architect-cli": "^0.1001.3",
    "@angular-devkit/build-angular": "~0.1001.3",
    "@angular/cli": "~10.1.3",
    "@angular/compiler-cli": "~10.1.3",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  }
}

run start via:

> npm run start

🔥 Exception or Error




Exception:
Error: Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(_).
    at MapSubscriber.project (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\src\architect.js:41:27)
    at MapSubscriber._next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\operators\map.js:49:35)
    at MapSubscriber.Subscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SafeSubscriber.__tryOrUnsub (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:143:22)
    at Subscriber._next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:89:26)
    at Subscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SafeSubscriber.__tryOrUnsub (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:143:22)
    at MergeMapSubscriber.notifyNext (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\operators\mergeMap.js:93:26)
    at SimpleInnerSubscriber._next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\innerSubscribe.js:27:21)
    at SimpleInnerSubscriber.Subscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\architect\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SafeSubscriber.__tryOrUnsub (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:205:16)
    at SafeSubscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:143:22)
    at Subscriber._next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:89:26)
    at Subscriber.next (E:\dev\code\bugtest\cli-bug\node_modules\@angular-devkit\core\node_modules\rxjs\internal\Subscriber.js:66:18)

🌍 Your Environment





     _                      _                 ____ _     ___ 
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | | 
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | | 
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.1.3
Node: 12.18.3
OS: win32 x64

Angular: 10.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.3
@angular-devkit/architect-cli   0.1001.3
@angular-devkit/build-angular   0.1001.3
@angular-devkit/core            10.1.3
@angular-devkit/schematics      10.1.3
@schematics/angular             10.1.3
@schematics/update              0.1001.3
rxjs                            6.6.3
typescript                      4.0.3

Anything else relevant?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: devkit/architect freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants