ng -v或ng generate给出错误消息TypeError:无法读取null的属性'glob'

时间:2018-11-02 23:07:18

标签: angular-cli-v6

在我的项目目录中,我运行ng -v或ng g服务并收到错误消息:

/users/ui/node_modules/@ngtools/json-schema/src/schema-tree.js:229
                this._children[name] = this._createChildProperty(name, value ? value[name] : undefined, forward ? forward.children[name] : null, propertySchema);
                                                                                                                                  ^

TypeError: Cannot read property 'glob' of null
    at ObjectSchemaTreeNode._set (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:229:131)
    at new ObjectSchemaTreeNode (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:214:14)
    at OneOfSchemaTreeNode._createChildProperty (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:153:26)
    at OneOfSchemaTreeNode._typesPrototype.schema.oneOf.map (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:166:25)
    at Array.map (<anonymous>)
    at new OneOfSchemaTreeNode (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:165:48)
    at ArraySchemaTreeNode._createChildProperty (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:153:26)
    at ArraySchemaTreeNode._set (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:291:39)
    at new ArraySchemaTreeNode (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:272:14)
    at ObjectSchemaTreeNode._createChildProperty (/Users/joannepham/git/pws/console-ui/node_modules/@ngtools/json-schema/src/schema-tree.js:153:26)

该文件夹之外没有问题。关于如何解决此问题的任何建议

谢谢

1 个答案:

答案 0 :(得分:0)

检查用户文件夹中是否有任何隐藏的 <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" card_view:cardCornerRadius="4dp" card_view:cardElevation="4dp" card_view:cardUseCompatPadding="true" tools:context=".testActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal"> <TextView android:id="@+id/textView15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="TextView" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Button" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal"> <TextView android:id="@+id/textView15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="TextView" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Button" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal"> <TextView android:id="@+id/textView15" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="TextView" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Button" /> </LinearLayout> </LinearLayout> </android.support.v7.widget.CardView> .angular-cli.json,并检查项目中的重复项