question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't generate library

See original GitHub issue

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"
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
mackelitocommented, Aug 14, 2018

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)

1reaction
alan-agius4commented, Aug 14, 2018

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do if you're having trouble signing into your library's ...
If you're prompted to select a library branch, be sure to select the correct branch. Sometimes different branches can have very similar names....
Read more >
How do I get a library card? - Libby Help
At the top of the library's home screen in Libby, tap I Would Like A Library Card or Use My Phone Number and...
Read more >
Invalid rule result: Instance of class Promise. - Stack Overflow
Cannot generate library. Invalid rule result: Instance of class ... when running ng generate library mylib. i get the following error:.
Read more >
Unable to install packages/Create library - General
Run RStudio as administrator to have write permissions on the system level library path "C:/Program Files/R/R-3.6.1/library" or define a user ...
Read more >
Cannot create Library when using Studio and Virtual Box
Hi: Another possible problem is that when you download the zip file for the Programming 1 class, we tell University Edition students to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found