代码之家  ›  专栏  ›  技术社区  ›  ufk

当项目中存在动态链接的目录时,ng生成失败

  •  0
  • ufk  · 技术社区  · 7 年前

    一般来说,我有几个项目要与之共享组件。

    我在马科斯莫哈韦10点14分

    我的 src/app

    16 -rw-r--r--   1 zoharzz  staff   792 Oct 20 19:21 app-routing.module.ts
    16 -rw-r--r--   1 zoharzz  staff  1173 Oct 20 19:02 app.component.html
     0 -rw-r--r--   1 zoharzz  staff     0 Oct 20 19:02 app.component.scss
    16 -rw-r--r--   1 zoharzz  staff  1113 Oct 20 19:02 app.component.spec.ts
    16 -rw-r--r--   1 zoharzz  staff   222 Oct 20 19:02 app.component.ts
    16 -rw-r--r--   1 zoharzz  staff  1508 Oct 20 20:19 app.module.ts
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 car-n-details-dialog
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 footer-toolbar
    16 -rw-r--r--   1 zoharzz  staff   647 Oct 20 19:58 graphql.module.ts
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 home
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:34 products
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 15 16:14 terms-page
     0 drwxr-xr-x   6 zoharzz  staff   204 Oct 20 19:39 toolbar
    16 lrwxr-xr-x   1 zoharzz  staff    45 Oct 20 20:22 tuxin-ec-accessibility -> ../../../tuxin-ec-libs/tuxin-ec-accessibility
    16 lrwxr-xr-x   1 zoharzz  staff    43 Oct 20 19:13 tuxin-ec-breadcrumbs -> ../../../tuxin-ec-libs/tuxin-ec-breadcrumbs
    16 lrwxr-xr-x   1 zoharzz  staff    36 Oct 20 19:13 tuxin-ec-cars -> ../../../tuxin-ec-libs/tuxin-ec-cars
    16 lrwxr-xr-x   1 zoharzz  staff    36 Oct 20 19:13 tuxin-ec-cart -> ../../../tuxin-ec-libs/tuxin-ec-cart
    16 lrwxr-xr-x   1 zoharzz  staff    42 Oct 20 19:13 tuxin-ec-contact-us -> ../../../tuxin-ec-libs/tuxin-ec-contact-us
     0 drwxr-xr-x   3 zoharzz  staff   102 Oct 20 20:18 tuxin-ec-libs
    16 lrwxr-xr-x   1 zoharzz  staff    48 Oct 20 19:35 tuxin-ec-login-management -> ../../../tuxin-ec-libs/tuxin-ec-login-management
    16 lrwxr-xr-x   1 zoharzz  staff    39 Oct 20 19:13 tuxin-ec-payment -> ../../../tuxin-ec-libs/tuxin-ec-payment
    16 lrwxr-xr-x   1 zoharzz  staff    39 Oct 20 19:13 tuxin-ec-product -> ../../../tuxin-ec-libs/tuxin-ec-product
    16 lrwxr-xr-x   1 zoharzz  staff    42 Oct 20 19:13 tuxin-ec-validators -> ../../../tuxin-ec-libs/tuxin-ec-validators
    

    所以当我试着用 ng build -c development

    ERROR in ../tuxin-ec-libs/tuxin-ec-accessibility/tuxin-ec-accessibility.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-accessibility/tuxin-ec-accessibility.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-breadcrumbs/tuxin-ec-breadcrumbs.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-breadcrumbs/tuxin-ec-breadcrumbs.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cars/car-type/tuxin-ec-car-type.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cars/car-type/tuxin-ec-car-type.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cart/cart-page/tuxin-ec-cart-page.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/cart-page/tuxin-ec-cart-page.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cart/delivery-options/tuxin-ec-delivery-options.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/delivery-options/tuxin-ec-delivery-options.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cart/invoice/tuxin-ec-invoice.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/invoice/tuxin-ec-invoice.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cart/side-cart/tuxin-ec-side-cart.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/side-cart/tuxin-ec-side-cart.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-cart/tuxin-ec-cart.service.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-cart/tuxin-ec-cart.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us-graphql.service.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us-graphql.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-contact-us/tuxin-ec-contact-us.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-login-management/login/tuxin-ec-login.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-login-management/login/tuxin-ec-login.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-login-management/tuxin-ec-user.service.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-login-management/tuxin-ec-user.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-payment/credit-card/tuxin-ec-credit-card.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-payment/credit-card/tuxin-ec-credit-card.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-payment/tuxin-ec-payment.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-payment/tuxin-ec-payment.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-product/hot-products/tuxin-ec-hot-products.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/hot-products/tuxin-ec-hot-products.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-product/product-card/tuxin-ec-product-card.component.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/product-card/tuxin-ec-product-card.component.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-product/tuxin-ec-category.service.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/tuxin-ec-category.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    ERROR in ../tuxin-ec-libs/tuxin-ec-product/tuxin-ec-product.service.ts
    Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
    Error: /Volumes/osx-storage/projects/wd/tuxin-ec-libs/tuxin-ec-product/tuxin-ec-product.service.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
        at AngularCompilerPlugin.getCompiledFile (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:762:23)
        at plugin.done.then (/Volumes/osx-storage/projects/wd/windy-client/node_modules/@ngtools/webpack/src/loader.js:41:31)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    

    当将目录复制到项目中而不是动态链接它们时,我不会遇到这些错误。

    所以。。。有没有办法修改angular.json以便它支持使用动态链接的目录?

    {
      "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
      "version": 1,
      "newProjectRoot": "projects",
      "projects": {
        "windy-client": {
          "root": "",
          "sourceRoot": "src",
          "projectType": "application",
          "prefix": "tuxin-ec",
          "schematics": {
            "@schematics/angular:component": {
              "styleext": "scss"
            }
          },
          "architect": {
            "build": {
              "builder": "@angular-devkit/build-angular:browser",
              "options": {
                "outputPath": "dist/windy-client",
                "index": "src/index.html",
                "main": "src/main.ts",
                "polyfills": "src/polyfills.ts",
                "tsConfig": "src/tsconfig.app.json",
                "assets": [
                  "src/favicon.ico",
                  "src/assets"
                ],
                "styles": [
                  "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
                  "src/styles.scss"
                ],
                "scripts": []
              },
              "configurations": {
                "production": {
                  "fileReplacements": [
                    {
                      "replace": "src/environments/environment.ts",
                      "with": "src/environments/environment.prod.ts"
                    }
                  ],
                  "optimization": true,
                  "outputHashing": "all",
                  "sourceMap": false,
                  "extractCss": true,
                  "namedChunks": false,
                  "aot": true,
                  "extractLicenses": true,
                  "vendorChunk": false,
                  "buildOptimizer": true,
                  "budgets": [
                    {
                      "type": "initial",
                      "maximumWarning": "2mb",
                      "maximumError": "5mb"
                    }
                  ]
                },
                "development": {
                  "fileReplacements": [
                    {
                      "replace": "src/environments/environment.ts",
                      "with": "src/environments/environment.dev.ts"
                    }
                  ]
                }
              }
            },
            "serve": {
              "builder": "@angular-devkit/build-angular:dev-server",
              "options": {
                "browserTarget": "windy-client:build"
              },
              "configurations": {
                "production": {
                  "browserTarget": "windy-client:build:production"
                },
                "development": {
                  "browserTarget": "windy-client:build:development"
                }
              }
            },
            "extract-i18n": {
              "builder": "@angular-devkit/build-angular:extract-i18n",
              "options": {
                "browserTarget": "windy-client:build"
              }
            },
            "test": {
              "builder": "@angular-devkit/build-angular:karma",
              "options": {
                "main": "src/test.ts",
                "polyfills": "src/polyfills.ts",
                "tsConfig": "src/tsconfig.spec.json",
                "karmaConfig": "src/karma.conf.js",
                "styles": [
                  "./node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
                  "src/styles.scss"
                ],
                "scripts": [],
                "assets": [
                  "src/favicon.ico",
                  "src/assets"
                ]
              }
            },
            "lint": {
              "builder": "@angular-devkit/build-angular:tslint",
              "options": {
                "tsConfig": [
                  "src/tsconfig.app.json",
                  "src/tsconfig.spec.json"
                ],
                "exclude": [
                  "**/node_modules/**"
                ]
              }
            }
          }
        },
        "windy-client-e2e": {
          "root": "e2e/",
          "projectType": "application",
          "prefix": "",
          "architect": {
            "e2e": {
              "builder": "@angular-devkit/build-angular:protractor",
              "options": {
                "protractorConfig": "e2e/protractor.conf.js",
                "devServerTarget": "windy-client:serve"
              },
              "configurations": {
                "production": {
                  "devServerTarget": "windy-client:serve:production"
                },
                "development": {
                  "devServerTarget": "windy-client:serve:development"
                }
              }
            },
            "lint": {
              "builder": "@angular-devkit/build-angular:tslint",
              "options": {
                "tsConfig": "e2e/tsconfig.e2e.json",
                "exclude": [
                  "**/node_modules/**"
                ]
              }
            }
          }
        }
      },
      "defaultProject": "windy-client"
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   ufk    7 年前

    在github上打开一个问题,似乎我缺少一个小的配置属性。

    他们的回答是:

    You should be able to do so using preserveSymlinks either via the command line or via the options inside the angular.json under architect/build/options
    
    Ex:
    
    "architect": {
      "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
          "preserveSymlinks": true,
          "index": "src/index.html",
          "main": "src/main.ts",
          ...
        }
      }
    }
    Check here: https://angular.io/cli/build
    
    推荐文章