AngularDoc / angulardoc.github.io

angulardoc.github.io web site
https://angulardoc.github.io
34 stars 2 forks source link

Error generating new component using schematics: "Path must be a string. Received null" error. #24

Closed ericksoen closed 6 years ago

ericksoen commented 6 years ago

Attempts to use the schematics feature of the VS Code extension (v6.0.3) to generate a new component triggers an error "Path must be a string. Received null". It's not immediately clear where the error in my install/setup is and how to remedy. VS Code version is 1.24.1.

Error occurs on project using angular.json file with dependencies on @angular/{common,core,compiler, etc.}@6.0.3 and dev-dependencies on@angular/cli@6.0.7` It's not immediately clear what the root cause of the issue is.

As additional context, here is a screenshot of the application structure that Angular Docs Application Explorer has built--it's missing my app.module.ts and its corresponding components.

agiledigits commented 6 years ago

It looked like a new project; how did you set it up? Did you run "ng new"? Could you provide the "angular.json" file?

ericksoen commented 6 years ago

I ran ng new using a custom schematic. I tried to re-generate a new application using the default Angular schematic and received the same results. Here's the angular.json file for the latter:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "angular-explorer-demo": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/angular-explorer-demo",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "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
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular-explorer-demo:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular-explorer-demo:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular-explorer-demo: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": [
              "src/styles.css"
            ],
            "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/**"
            ]
          }
        }
      }
    },
    "angular-explorer-demo-e2e": {
      "root": "e2e/",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "angular-explorer-demo:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular-explorer-demo:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": "e2e/tsconfig.e2e.json",
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "angular-explorer-demo"
}
agiledigits commented 6 years ago

We made a fix and released it in v6.0.5. Please install it and le us know if it fixed your issue.

ericksoen commented 6 years ago

Thanks for the rapid response. I'm able to generate schematics now using the tool.