【发布时间】:2017-02-08 04:55:55
【问题描述】:
使用 Angular2,在移入项目文件夹后,我在尝试通过 CLI 创建新组件时遇到此错误,我将发布所有终端消息:
edoardocanti$ ng generate component other
Could not start watchman; falling back to NodeWatcher for file system
events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
installing component
create src/app/other/other.component.css
create src/app/other/other.component.html
create src/app/other/other.component.spec.ts
create src/app/other/other.component.ts
Cannot read property 'read' of undefined
TypeError: Cannot read property 'read' of undefined
at InsertChange.apply (/Users/edoardocanti/first-
app/node_modules/@angular-cli/ast-tools/src/change.js:96:20)
at /Users/edoardocanti/first-app/node_modules/@angular-cli/ast-
tools/src/change.js:71:61
at process._tickCallback (internal/process/next_tick.js:103:7)
它创建了我的新组件的文件夹,但我必须在 app.module.ts 中手动添加它,但是它可以工作。
真正的问题是当我尝试在现有文件夹中创建新组件时,在这种情况下,Angular 不会创建任何新组件。
【问题讨论】:
-
我也被这个问题困扰过,但是同样版本的 angular-cli 对我几天前创建的另一个项目也能正常工作
标签: angularjs macos angular terminal command-line-interface