angular-cli: Can't generate library

Bug Report or Feature Request (mark with an x)

- [ x ] bug report -> please search issues before submitting

Command (mark with an x)

- [ x ] generate

Versions

npm: 6.2.0 Angular CLI: 6.1.3 Node: 10.8.0 OS: darwin x64 Angular: 6.1.2 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router, service-worker

Package Version

@angular-devkit/architect 0.6.5 @angular-devkit/build-angular 0.6.5 @angular-devkit/build-optimizer 0.6.5 @angular-devkit/core 0.7.3 @angular-devkit/schematics 0.7.3 @angular/cdk 6.4.3 @angular/cli 6.1.3 @angular/flex-layout 6.0.0-beta.17 @angular/material 6.4.3 @angular/pwa 0.6.8 @ngtools/webpack 6.0.5 @schematics/angular 0.6.8 @schematics/update 0.7.3 rxjs 6.2.2 typescript 2.9.2 webpack 4.8.3

Repro steps

ng g library core --prefix=fc

The log given by the failure

Cannot read property ‘entries’ of undefined

Desired functionality

Would like go get my library 😄

Mention any other details that might be useful

I have tested on a fresh project and that works… My guess is that there is something wonky with the angular.json. We have been using the CLI for some time and belive that the upgrades along the way might have something to do with the issue.

Note: ng g c test works just fine

angular.json file:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
      "newProjectRoot": "projects",
        "projects": {
    "market": {
      "root": "",
        "sourceRoot": "src",
          "projectType": "application",
            "schematics": {
        "@schematics/angular:component": {
          "changeDetection": "OnPush",
            "prefix": "fcd",
              "styleext": "scss"
        },
        "@schematics/angular:directive": {
          "prefix": "fcd"
        }
      },
      "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",
                        "src/favicon.ico",
                        "src/favicon-16x16.png",
                        "src/favicon-32x32.png",
                        "src/manifest.json"
                      ],
                        "styles": [
                          "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,
                                  "serviceWorker": true
            },
            "staging": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.staging.ts"
                }
              ],
                "optimization": true,
                  "outputHashing": "all",
                    "sourceMap": true,
                      "extractCss": true,
                        "namedChunks": false,
                          "aot": true,
                            "extractLicenses": true,
                              "vendorChunk": false,
                                "buildOptimizer": true,
                                  "serviceWorker": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
            "options": {
            "browserTarget": "market:build",
              "host": "0.0.0.0"
          },
          "configurations": {
            "production": {
              "browserTarget": "market:build:production"
            },
            "staging": {
              "browserTarget": "market:build:staging"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
            "options": {
            "browserTarget": "market:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
            "options": {
            "main": "src/test.ts",
              "karmaConfig": "./karma.conf.js",
                "polyfills": "src/polyfills.ts",
                  "tsConfig": "src/tsconfig.spec.json",
                    "scripts": [],
                      "styles": [
                        "src/styles.scss"
                      ],
                        "assets": [
                          "src/assets",
                          "src/favicon.ico",
                          "src/manifest.json"
                        ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
            "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
              "exclude": [
                "**/node_modules/**"
              ]
          }
        }
      }
    },
    "market-e2e": {
      "root": "e2e/",
        "sourceRoot": "",
          "projectType": "application",
            "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
            "options": {
            "protractorConfig": "./protractor.conf.js",
              "devServerTarget": "market:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
            "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
              "exclude": []
          }
        }
      }
    }
  },
  "defaultProject": "market",
    "cli": {
    "packageManager": "yarn"
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

running

rm -rf node_modules/

and then

ng g library core --prefix=fc

worked… But only if I did NOT install before… (using yarn or npm)

I have tried this with the latest beta using your angular.json and I cannot reproduce the issue.