Angular-cli: glob' of null when trying to build

Created on 22 Feb 2017  ·  17Comments  ·  Source: angular/angular-cli

Please provide us with the following information:

OS?

Linux 4.4.0-63-generic #84-Ubuntu SMP x86_64 x86_64 GNU/Linux

Versions.

@angular/cli: 1.0.0-beta.32.3
node: 7.6.0
os: linux x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8

Repro steps.

ng build --env=prod

The log given by the failure.

TypeError: Cannot read property 'glob' of null
at ObjectSchemaTreeNode._set (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:226:131)
at new ObjectSchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:211:14)
at OneOfSchemaTreeNode._createChildProperty (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:150:26)
at OneOfSchemaTreeNode._typesPrototype.schema.oneOf.map (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:163:25)
at Array.map (native)
at OneOfSchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:162:48)
at ArraySchemaTreeNode._createChildProperty (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:150:26)
at ArraySchemaTreeNode._set (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:288:39)
at new ArraySchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:269:14)
at ObjectSchemaTreeNode._createChildProperty (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:150:26)
at ObjectSchemaTreeNode._set (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:226:45)
at new ObjectSchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:211:14)
at ArraySchemaTreeNode._createChildProperty (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:150:26)
at ArraySchemaTreeNode._set (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:288:39)
at new ArraySchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:269:14)
at RootSchemaTreeNode._createChildProperty (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:150:26)
at RootSchemaTreeNode._set (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:226:45)
at RootSchemaTreeNode.ObjectSchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:211:14)
at RootSchemaTreeNode (/app/node_modules/@ngtools/json-schema/src/schema-tree.js:309:9)
at GeneratedSchemaClass.SchemaClassBase (/app/node_modules/@ngtools/json-schema/src/schema-class-factory.js:52:29)
at GeneratedSchemaClass (/app/node_modules/@ngtools/json-schema/src/schema-class-factory.js:140:13)
at new CliConfig (/app/node_modules/@angular/cli/models/config/config.js:17:24)
at Function.fromConfigPath (/app/node_modules/@angular/cli/models/config/config.js:80:16)
at Function.fromProject (/app/node_modules/@angular/cli/models/config.js:79:46)
at Object. (/app/node_modules/@angular/cli/commands/build.js:5:35)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Class.includedCommands (/app/node_modules/@angular/cli/addon/index.js:22:16)
at /app/node_modules/@angular/cli/ember-cli/lib/models/project.js:287:61
at Array.forEach (native)
at Project.addonCommands (/app/node_modules/@angular/cli/ember-cli/lib/models/project.js:286:15)
at Project.eachAddonCommand (/app/node_modules/@angular/cli/ember-cli/lib/models/project.js:321:30)
at module.exports (/app/node_modules/@angular/cli/ember-cli/lib/cli/lookup-command.js:33:13)
at CLI. (/app/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:42:26)
at tryCatch (/app/node_modules/rsvp/dist/rsvp.js:538:12)
at invokeCallback (/app/node_modules/rsvp/dist/rsvp.js:553:13)
at publish (/app/node_modules/rsvp/dist/rsvp.js:521:7)
at flush (/app/node_modules/rsvp/dist/rsvp.js:2373:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)

Mention any other details that might be useful.

Generated a new app using the CLI and did a deployment with dokku to digitalocean


Thanks! We'll be in touch soon.

Most helpful comment

I was facing same issue, I had run ng unit in system root directory by mistake. Once I had delete all the angular-cli files it was working

What I had don to resolve on windows-10 system.

  1. Open cmd.
  2. Run dir. (in Linux or mac its ls).
  3. If you find angular-cli files just delete.
    And it's work for me.

Sent from my iPhone

On Mar 3, 2017, at 3:14 PM, Dominic Watson notifications@github.com wrote:

Debugging this a little. I'm also getting input of null when pushing an ng2 app. I'm only getting this when pushing to a Deis PaaS application but everything works when it's Heroku. I'm even using the same build pack but it's still not working.

I see that glob, input and output are all values of schema.json to do with the assets array for copying stuff over.

I've tried:

angular-cli rc.0 and 1
having at least 1 file inside the assets folder for copying (as it was empty)
removing my project yarn.lock to enforce npm
copying the schema.json to the root of my project and referencing it inside .angular-cli.json
node 6 and 7
Deleting the assets property entirely from .angular-cli.json gives me the input of null error so I guess that's why my ng2 project gets that error when pushing to Deis PaaS


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

All 17 comments

same error here after updating from angular-cli to angular/cli

same error here , I am using windows 10
@angular/cli: 1.0.0-beta.32.3
node: 6.10.0
os: win32 x64

Even ng serve is not working for me

I am having the exact same error. I have uninstalled node entirely. brew installed node again. And installed @angular/cli from scratch. I also tried downgrading versions of cli and it still happens.

What is going on?

@angular/cli: 1.0.0-beta.32.3
node: 7.5.0
os: darwin x64
@angular/cli: 1.0.0-beta.32.3
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/compiler-cli: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/platform-server: 2.4.8
@angular/router: 3.4.8

I’m facing the same issue with @angular/cli 1.0.0-rc.0, and this is just angular/cli ng new app nothing fancy.

F:\TyVBShare\tychonSource\my-project>ng build --prod --aot
Cannot read property 'glob' of null
TypeError: Cannot read property 'glob' of null
    at ObjectSchemaTreeNode._set (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:224:131)
    at new ObjectSchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:209:14)
    at OneOfSchemaTreeNode._createChildProperty (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:148:26)
    at OneOfSchemaTreeNode._typesPrototype.schema.oneOf.map (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:161:25)
    at Array.map (native)
    at OneOfSchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:160:48)
    at ArraySchemaTreeNode._createChildProperty (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:148:26)
    at ArraySchemaTreeNode._set (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:286:39)
    at new ArraySchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:267:14)
    at ObjectSchemaTreeNode._createChildProperty (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:148:26)
    at ObjectSchemaTreeNode._set (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:224:45)
    at new ObjectSchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:209:14)
    at ArraySchemaTreeNode._createChildProperty (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:148:26)
    at ArraySchemaTreeNode._set (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:286:39)
    at new ArraySchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:267:14)
    at RootSchemaTreeNode._createChildProperty (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:148:26)
    at RootSchemaTreeNode._set (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:224:45)
    at RootSchemaTreeNode.ObjectSchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:209:14)
    at RootSchemaTreeNode (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-tree.js:307:9)
    at GeneratedSchemaClass.SchemaClassBase (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-class-factory.js:53:29)
    at GeneratedSchemaClass (F:\TyVBShare\tychonSource\my-project\node_modules\@ngtools\json-schema\src\schema-class-factory.js:144:13)
    at new CliConfig (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\models\config\config.js:18:24)
    at Function.fromConfigPath (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\models\config\config.js:81:16)
    at Function.fromProject (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\models\config.js:76:46)
    at Object.<anonymous> (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\commands\build.js:7:35)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Class.includedCommands (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\addon\index.js:22:16)
    at F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\ember-cli\lib\models\project.js:287:61
    at Array.forEach (native)
    at Project.addonCommands (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\ember-cli\lib\models\project.js:286:15)
    at Project.eachAddonCommand (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\ember-cli\lib\models\project.js:321:30)
    at module.exports (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\ember-cli\lib\cli\lookup-command.js:33:13)
    at CLI.<anonymous> (F:\TyVBShare\tychonSource\my-project\node_modules\@angular\cli\ember-cli\lib\cli\cli.js:46:26)
    at tryCatch (F:\TyVBShare\tychonSource\my-project\node_modules\rsvp\dist\rsvp.js:538:12)
    at invokeCallback (F:\TyVBShare\tychonSource\my-project\node_modules\rsvp\dist\rsvp.js:553:13)
    at publish (F:\TyVBShare\tychonSource\my-project\node_modules\rsvp\dist\rsvp.js:521:7)
    at flush (F:\TyVBShare\tychonSource\my-project\node_modules\rsvp\dist\rsvp.js:2373:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

F:\TyVBShare\tychonSource\my-project>cd ..

F:\TyVBShare\tychonSource>ng --version

@angular/cli: 1.0.0-rc.0
node: 6.9.4
os: win32 x64

F:\TyVBShare\tychonSource>

My .angular-cli.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "my-project"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "component": {}
  }
}

and package.json

{
  "name": "my-project",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.0",
    "@angular/compiler": "^2.4.0",
    "@angular/core": "^2.4.0",
    "@angular/forms": "^2.4.0",
    "@angular/http": "^2.4.0",
    "@angular/platform-browser": "^2.4.0",
    "@angular/platform-browser-dynamic": "^2.4.0",
    "@angular/router": "^3.4.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.7.6"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-rc.0",
    "@angular/compiler-cli": "^2.4.0",
    "@types/jasmine": "2.5.38",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.4.2",
    "typescript": "~2.0.0"
  }
}

Anyone with a fix for this?

Debugging this a little. I'm also getting input of null when pushing an ng2 app. I'm only getting this when pushing to a Deis PaaS application but everything works when it's Heroku. I'm even using the same build pack but it's still not working.

I see that glob, input and output are all values of schema.json to do with the assets array for copying stuff over.

I've tried:

  • angular-cli rc.0 and 1
  • without AOT flag
  • having at least 1 file inside the assets folder for copying (as it was empty)
  • removing my project yarn.lock to enforce npm
  • copying the schema.json to the root of my project and referencing it inside .angular-cli.json
  • node 6 and 7
  • removing assets property entirely
  • removing assets folder and favicon.ico from assets property
  • renaming .angular-cli.json to angular-cli.json

Deleting the assets property entirely from .angular-cli.json gives me the input of null error so I guess that's why my ng2 project gets that error when pushing to Deis PaaS

It seems there are a couple of related issues: https://github.com/angular/angular-cli/issues/4889 and https://github.com/angular/angular-cli/issues/4207

My error, which may signify that it also doesn't work from /tmp/build:

Cannot read property 'glob' of null
       TypeError: Cannot read property 'glob' of null
       at ObjectSchemaTreeNode._set (/tmp/build/node_modules/@ngtools/json-schema/src/schema-tree.js:224:131)

I was facing same issue, I had run ng unit in system root directory by mistake. Once I had delete all the angular-cli files it was working

What I had don to resolve on windows-10 system.

  1. Open cmd.
  2. Run dir. (in Linux or mac its ls).
  3. If you find angular-cli files just delete.
    And it's work for me.

Sent from my iPhone

On Mar 3, 2017, at 3:14 PM, Dominic Watson notifications@github.com wrote:

Debugging this a little. I'm also getting input of null when pushing an ng2 app. I'm only getting this when pushing to a Deis PaaS application but everything works when it's Heroku. I'm even using the same build pack but it's still not working.

I see that glob, input and output are all values of schema.json to do with the assets array for copying stuff over.

I've tried:

angular-cli rc.0 and 1
having at least 1 file inside the assets folder for copying (as it was empty)
removing my project yarn.lock to enforce npm
copying the schema.json to the root of my project and referencing it inside .angular-cli.json
node 6 and 7
Deleting the assets property entirely from .angular-cli.json gives me the input of null error so I guess that's why my ng2 project gets that error when pushing to Deis PaaS


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

In https://github.com/angular/angular-cli/issues/4889#issuecomment-281551688, @huntsberg said:

It looks like #4207 is the same issue. If you set up the environment in your home directory, it fails. It's a common pattern in docker to put the app in the home directory.
Changing the home directory seems to resolve the issue.

I have tried the following option to resolve the issue
Steps to resolve the issue

$ pwd
it shows —> /Users/YourName /* That is your Home path*/
Execute the below command to display the hidden files

$ defaults write com.apple.Finder AppleShowAllFiles true
$ killall Finder
After executing the above command you will see the hidden files.
if “.angular-cli.json” file exist under “/Users/yourname” (i.e Home Path) then remove “.angular-cli.json” file.

then navigate to your application path and try execute ‘ng’ command.

I have tried the following option to resolve the issue
Steps to resolve the issue

$ pwd
it shows —> /Users/YourName /* That is your Home path*/
Execute the below command to display the hidden files

$ defaults write com.apple.Finder AppleShowAllFiles true
$ killall Finder
After executing the above command you will see the hidden files.
if “.angular-cli.json” file exist under “/Users/yourname” (i.e Home Path) then remove “.angular-cli.json” file.

then navigate to your application path and try execute ‘ng’ command.

@balr404 thanks ,it works

Still doesn't work for me!

works for me on 1.3.1 i also change the dev in the package from angular/cli 131 to angular cli 1.7.4 (may be optional)

verify that u own the directrory (" chown groupe:user directory " on ubuntu) and try root launch for the ng (sudo)

or / and
remove the node dir and -lock.json, run npm i and launch or sudo launch ng

Try sudo of ur ng first, not to have to have to reinstall if not necessary
im on debian 9.4

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NCC1701M picture NCC1701M  ·  3Comments

hartjo picture hartjo  ·  3Comments

sysmat picture sysmat  ·  3Comments

hareeshav picture hareeshav  ·  3Comments

gotschmarcel picture gotschmarcel  ·  3Comments