Updated code compatible with Angular 13

I spent quite a while figuring out and updating the code in the angular tutorial. I decide to make my code public so maybe it can help some of you guys out. As of 6/2022 I have up to the authentication and authorization lessons updated. If you have any questions the best way to contact me is through the GitHub page.

5 Likes

Hi

Thank you so much. I have been stuck at extending Post service to Data Service for a while now.

1 Like

Thanks a lot it is very helpful!

Thank you so much for sharing this !
I wish Mosh had time to update this course!
So much have changed since Angular 4

2 Likes

Thank you for sharing this. Very useful.

Hi, I downloaded this and cannot get it to run. I tried using Node versions: (12.20.2,
14.15.0, 16.10.0) I uninstalled angular cli with (npm uninstall -g @angular/cli) and then installed version 13.3.0 as in package.json (npm install -g @angular/cli/@13.3.0). I can run npm install on the project but when I run ng serve I get errors in node_modules. I’ll copy and paste an example below. They are javascript errors always in node_modules/@angular. Any advice on how to get this running?

[error] TypeError: (0 , node_os_1.availableParallelism) is not a function
at Object. (C:\Users\ryanb\angular-lessons-master\node_modules@angular\build\src\utils\environment-options.js:72:63)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\ryanb\angular-lessons-master\node_modules@angular\build\src\tools\esbuild\angular\compiler-plugin.js:40:31)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1153:10)

TLDR; what is the magic combination of node.js and angular-cli needed to run this project?

I still can’t get this project to run. Here is a step by step explanation of what I have tried.

  1. First, I’m using nvm to install/run different versions of node

  2. I tried using 12.11.1 as in package.json but when I try to install angular-cli 13.3.0 I get the following error: The Angular CLI requires a minimum Node.js version of either v12.20, v14.15, or v16.10.

  3. So, I use node 12.20.2

  4. I can install angular cli 13.3.0 and run npm install. I can run ng version. Here is the output: PS C:\Users\ryanb\angular-lessons-master> ng version


    / \ _ __ __ _ _ | | __ _ _ __ / | | | |
    / △ \ | ’
    \ / _ | | | | |/ _ | '
    | | | | | | |
    / ___ | | | | (
    | | || | | (| | | | || | | |
    // __| ||_, |_,||_,|| _|||
    |___/

Angular CLI: 13.3.0
Node: 12.20.2
Package Manager: npm 6.14.11
OS: win32 x64

Angular: 13.3.12
… animations, common, compiler, compiler-cli, core, forms

Package Version
@angular-devkit/architect 0.1900.2
@angular-devkit/build-angular 19.0.2
@angular-devkit/schematics 19.0.2
@angular/cli 19.0.2
@schematics/angular 19.0.2
rxjs 7.5.7
typescript 4.6.4

  1. But when I run ng serve I get the following error: [error] C:\Users\ryanb\angular-lessons-master\node_modules@angular-devkit\core\src\json\schema\transforms.js:17
    value ??= schema.default;
    ^

SyntaxError: Unexpected token ‘?’
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (C:\Users\ryanb\angular-lessons-master\node_modules@angular-devkit\core\src\json\schema\index.js:37:33)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:1027:10)

  1. I Google the error and find this: The nullish coalescing operator (??=) assigns a value to a variable only if the variable is null or undefined.
    Older versions of Node.js do not support this operator.
    Updating to a newer Node.js version will add support for this operator and resolve the error.

  2. So I switch a newer node version nvm use 14.15.0 (I tried 22.1.0 as well) but now ng version doesn’t even work: PS C:\Users\ryanb\angular-lessons-master> nvm use 14.15.0
    Now using node v14.15.0 (64-bit)
    PS C:\Users\ryanb\angular-lessons-master> ng version
    ng : The term ‘ng’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
    verify that the path is correct and try again.
    At line:1 char:1

  • ng version
  • ~~
    • CategoryInfo : ObjectNotFound: (ng:String) , CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
  1. At this point every thing is out of whack and I can’t run anything. I have to switch back to node version I used originally (12.20.2) to uninstall angular cli.
  2. I’ve tried this same strategy starting with a newer version of node. But it’s the same thing. When I run ng serve I get some random javascript error in node_modules.
  3. What am I missing?