Windows 10 - 64bit
angular-cli:
1.0.0-beta.15
npm:
3.10.7
node:
6.6.0
angular's versions:
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/http": "2.0.1",
"@angular/material": "^2.0.0-alpha.9",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/router": "3.0.0",
I did change the defaults -> styleExt to "scss", so the angular would create the scss files for me, but I did not try creating anything before the change. I also did an installation of @anuglar/material package. The app was completely new (state right after 'ng new XXX'). Now I was trying to create the first component and it's creating it, but after creating a .ts file it shows me the error above.
C:\SERVER\htdocs\MySite>ng g component sidenav
installing component
identical src\app\sidenav\sidenav.component.css
identical src\app\sidenav\sidenav.component.html
identical src\app\sidenav\sidenav.component.spec.ts
identical src\app\sidenav\sidenav.component.ts
Cannot read property 'read' of undefined
TypeError: Cannot read property 'read' of undefined
at InsertChange.apply (C:\SERVER\htdocs\MySite\node_modules\@angular-cli\ast-tools\src\change.js:96:20)
at C:\SERVER\htdocs\MySite\node_modules\@angular-cli\ast-tools\src\change.js:71:61
at process._tickCallback (internal/process/next_tick.js:103:7)
same for me
Same error but not using scss. I simply tried generating a component. I'm using beta 15 of angular-cli, node 5.12.0, and 2.0.0 of the angular framework components. Windows 7, and it was working earlier. No changes except OS security updates.
Same issue here. Ubuntu 16.04, beta 15 of angular-cli
Well, it's not a big problem, because the only problem is that it's not adding the components, etc. to the app.module.ts, so I'm working with it and manually add them there.
But well, it would be great to have it all repaired again.
Same issue here. Mac OS X and no SCSS
same
mac os x 10.11.6 while generating component
node 6.7.0
"dependencies": {
"@angular/common": "2.0.1",
"@angular/compiler": "2.0.1",
"@angular/core": "2.0.1",
"@angular/forms": "2.0.1",
"@angular/http": "2.0.1",
"@angular/platform-browser": "2.0.1",
"@angular/platform-browser-dynamic": "2.0.1",
"@angular/router": "3.0.0",
"bootstrap": "^4.0.0-alpha.4",
"core-js": "^2.4.1",
"font-awesome": "^4.6.3",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23"
},
"devDependencies": {
"@types/jasmine": "^2.2.30",
"angular-cli": "1.0.0-beta.15",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.3"
}
it seems it is fixed now in beta 16... I just added this answer in stackoverflow:
http://stackoverflow.com/questions/39777519/angular2-error-while-creating-new-component-via-cli/39794397#39794397
Check the version and make sure you are on latest:
ng -v
angular-cli: 1.0.0-beta.16
node: 6.2.0
os: darwin x64
Remove old and install new:
npm uninstall -g angular-cli
npm remove cache
npm install -g angular-cli@latest
if you have an existing project:
may also need to remove node_modules
IMPORTANT STEPS
look everywhere for beta.15 and replace with beta.16
Change:
angular-cli.json:
"version": "1.0.0-beta.16",
package.json:
"devDependencies": {
"angular-cli": "1.0.0-beta.16",
important to also change it to "angular-cli": "1.0.0-beta.16" in your package.json devDependencies,
after that and changing my typescript from 2.0.3 to 2.0.2 it works for me
I am facing the same issue, however even after following the steps mentioned.
npm uninstall -g angular-cli
npm remove cache
npm install -g angular-cli@latest
Its still using beta.15
Okay, when I updated the package.json and then ran an "npm install" from the project directory, that solved the issue.
Thanks.
I have a Windows 10 machine with the same npm, node, and cli versions as my Win 7 and no issues. Strange.
Works for me
This issue should be closed
I have reproduced it with the beta.15, but it's gone with beta.16
Thanks, @scastaldi
Updated from "beta.15" to "beta.16" and problem disappeared.
Fixed in beta.16.
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._
Most helpful comment
it seems it is fixed now in beta 16... I just added this answer in stackoverflow:
http://stackoverflow.com/questions/39777519/angular2-error-while-creating-new-component-via-cli/39794397#39794397
Check the version and make sure you are on latest:
Remove old and install new:
if you have an existing project:
may also need to remove node_modules
IMPORTANT STEPS
look everywhere for beta.15 and replace with beta.16
Change: