shyamseshadri / angular-up-and-running

Code repository for the Angular: Up & Running Book, which covers Angular 2+, using TypeScript and more...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample code is already obsolete!!

jroughgarden opened this issue · comments

I am an experienced .Net developer and was taking a Udemy course in AngularJS when I realized that it was obsolete. So I got this book to re-start with the latest Angular. But now I find that this book's code, published only THREE months ago, is already obsolete. I can't even get 'ng serve' to work because my downloaded Angular/CLI version (6.2.1) requires an angular.json file rather than the deprecated .angular-cli.json file. When I Google the issue, I'm told to run the 'ng update @angular/cli --migrate-only --from=1.7.3' command to replace the old file (3 months old) with the new file. But it does not work!!
Mr. Sheshadri, you really need to update all your code and make it available on git. As it is this book is worthless to a novice Angular learner. When I download and install Node.js, typescript, and Angular/CLI as instructed, and then download your codebase from GIT, nothing works. Sorry, but the truth hurts.

commented

I agree a new release of these exercises is needed for Angular 6.
I had Angular 6 already installed before I attempted to run the exercise solutions from github.

After several attempts this worked for me on Exercise 3, 4 & 5.
I'm an Angular newbie so I may be doing it in a sub-optimal way.

Upgrade steps
ng update
We analyzed your package.json, there are some packages to update:

  Name                               Version                  Command to update
 --------------------------------------------------------------------------------
  @angular/cli                       1.7.4 -> 6.2.3           ng update @angular/cli
  @angular/core                      5.2.11 -> 6.1.9          ng update @angular/core
  rxjs                               5.5.12 -> 6.3.3          ng update rxjs


There might be additional packages that are outdated.
Or run ng update --all to try to update all at the same time.

=========================

--to prevent rxjs errors
npm install --save rxjs-compat

ng update @angular/cli
ng update @angular/core
ng update rxjs
ng update --still no angular.json created

--now creates a angular.json file and updates other .json files
ng update @angular/cli --migrate-only --from=1.7.4

--with the angular.json file ng serve now works
ng serve

=====================
Environment
I was using Windows 10
ng -v

Angular CLI: 6.2.3
Node: 8.9.4
OS: win32 x64
Angular: 6.1.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.8.3
@angular-devkit/build-angular 0.8.3
@angular-devkit/build-optimizer 0.8.3
@angular-devkit/build-webpack 0.8.3
@angular-devkit/core 0.8.3
@angular-devkit/schematics 0.8.3
@angular/cli 6.2.3
@ngtools/webpack 6.2.3
@schematics/angular 0.8.3
@schematics/update 0.8.3
rxjs 6.3.3
typescript 2.9.2
webpack 4.20.2

perhaps try running ng update @angular/cli @angular/core