【问题标题】:I am getting following error when running ng serve运行 ng serve 时出现以下错误
【发布时间】:2019-08-18 16:03:23
【问题描述】:

我是新手,我对 VSCode 有疑问。运行 ng serve 时出现以下错误:


PS C:\Windows\System32\x-app> ng serve --configuration=it
An unhandled exception occurred: Workspace config file cannot le loaded: C:\Windows\System32\x-app\angular.json    
Invalid JSON character: "\"" at 73:7.
See "C:\Users\C-PROJ~1\AppData\Local\Temp\ng-LpcKJr\angular-errors.log" for further details

[error] Error: Workspace config file cannot le loaded: C:\Windows\System32\x-app\angular.json
Invalid JSON character: "\"" at 73:7.
    at Object.getWorkspace (C:\Windows\System32\x-app\node_modules\@angular\cli\utilities\config.js:59:15)
    at ServeCommand.validateScope (C:\Windows\System32\x-app\node_modules\@angular\cli\models\command.js:97:60)
    at ServeCommand.validateAndRun (C:\Windows\System32\x-app\node_modules\@angular\cli\models\command.js:122:24)
    at Object.runCommand (C:\Windows\System32\x-app\node_modules\@angular\cli\models\command-runner.js:185:38)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

我使用prettier,事实上,我注意到内部化存在疏忽。我修复了json文件,返回了命令ng serve --configuration=it,结果又报错了。


PS C:\Windows\System32\x-app> ng serve --configuration=it
An unhandled exception occurred: Project does not exist.
See "C:\Users\C-PROJ~1\AppData\Local\Temp\ng-IomfPN\angular-errors.log" for further details.

[error] Error: Project does not exist.
    at WorkspaceNodeModulesArchitectHost.findProjectTarget (C:\Windows\System32\x-app\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:94:23)
    at WorkspaceNodeModulesArchitectHost.getOptionsForTarget (C:\Windows\System32\x-app\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:66:33)
    at core_1.experimental.jobs.createJobHandler.target (C:\Windows\System32\x-app\node_modules\@angular-devkit\architect\src\architect.js:171:21)
    at Observable.rxjs_1.Observable.subject [as _subscribe] (C:\Windows\System32\x-app\node_modules\@angular-devkit\core\src\experimental\jobs\create-job-handler.js:91:26)
    at Observable._trySubscribe (C:\Windows\System32\x-app\node_modules\rxjs\internal\Observable.js:44:25)
    at Observable.subscribe (C:\Windows\System32\x-app\node_modules\rxjs\internal\Observable.js:30:22)
    at C:\Windows\System32\x-app\node_modules\rxjs\internal\util\subscribeTo.js:22:31
    at Object.subscribeToResult (C:\Windows\System32\x-app\node_modules\rxjs\internal\util\subscribeToResult.js:10:45)
    at SwitchMapSubscriber._innerSub (C:\Windows\System32\x-app\node_modules\rxjs\internal\operators\switchMap.js:65:54)
    at SwitchMapSubscriber._next (C:\Windows\System32\x-app\node_modules\rxjs\internal\operators\switchMap.js:55:14)
    at SwitchMapSubscriber.Subscriber.next (C:\Windows\System32\x-app\node_modules\rxjs\internal\Subscriber.js:66:18)
    at SwitchMapSubscriber.notifyNext (C:\Windows\System32\x-app\node_modules\rxjs\internal\operators\switchMap.js:86:26)
    at InnerSubscriber._next (C:\Windows\System32\x-app\node_modules\rxjs\internal\InnerSubscriber.js:28:21)
    at InnerSubscriber.Subscriber.next (C:\Windows\System32\x-app\node_modules\rxjs\internal\Subscriber.js:66:18)
    at MapSubscriber._next (C:\Windows\System32\x-app\node_modules\rxjs\internal\operators\map.js:55:26)
    at MapSubscriber.Subscriber.next (C:\Windows\System32\x-app\node_modules\rxjs\internal\Subscriber.js:66:18)

【问题讨论】:

  • 也发布您的angular.json 文件
  • 您不应该在“c:\Windows\System32\”文件夹中。
  • 你可以查看这个解决方案ng serve error

标签: json angular terminal internationalization


【解决方案1】:

您的angular.json 可能格式不正确。请检查文件是否符合json 标准。你可以使用prettier之类的工具来格式化json。

【讨论】:

    猜你喜欢
    • 2019-08-25
    • 2019-08-28
    • 2019-01-07
    • 2020-05-30
    • 2017-09-30
    • 1970-01-01
    • 2019-11-19
    • 1970-01-01
    • 2021-10-25
    相关资源
    最近更新 更多