`path must start with the project source root` ng serve 错误

Man*_*dha 2 angular-cli-v6

我想在我的项目中使用jquery和。该项目是在目录中,并且文件在路径。我正在尝试按如下方式引用和文件,但是在目录中运行时,出现错误 - 。我究竟做错了什么?bootstrapAngular-CLIAngular-CLIproject/uijquerybootstrapproject/public/...jquerybootstrapangular.jsonng serveproject/uiThe ./../public/images/favicon.png asset path must start with the project source root

的片段angular.json

"projects": {
    "ui": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              "src/assets",
              "./../public/images/favicon.png"
            ],
            "styles": [
              "src/styles.css",
              "./../public/stylesheets/common/css-reset.css",
              "./../public/stylesheets/common/common-styles.css",
              "./../public/stylesheets/common/vendor/bootstrap/bootstrap.css"
            ],
            "scripts": [
              "./../public/javascripts/common/vendor/jquery/jquery-3.2.1.js",
              "./../public/javascripts/common/vendor/bootstrap/bootstrap.js"
            ]
          },
Run Code Online (Sandbox Code Playgroud)

md_*_*alm 7

//file - angular.json

"assets": [
   "src/assets",
   "src/favicon.ico"    //This worked for me.
]
Run Code Online (Sandbox Code Playgroud)

  • https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/asset-configuration.md#writing-assets-outside-of-dist - 链接到此背后的其他上下文 (2认同)