Fixing angular installation 15.0.5 - node.js

ng v shows:
Angular CLI: 15.0.5
Node: 16.15.1
Package Manager: npm 9.2.0
OS: win32 x64
Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
#angular-devkit/architect 0.1500.5 (cli-only)
#angular-devkit/build-angular 15.1.2 (cli-only)
#angular-devkit/core 15.0.5 (cli-only)
#angular-devkit/schematics 15.0.5 (cli-only)
#angular/cli 15.0.5 (cli-only)
#schematics/angular 15.0.5 (cli-only)
rxjs 6.6.7 (cli-only)
typescript 4.9.4 (cli-only)
How do I resolve the part which shows Angular: <error>?
I have tried:
npm uninstall -g #angular/cli
npm i -g #angular/cli#15.0.5
But I get the same result.

in your case you should approve the version of the typescript.
I suppose, you have to upgrade your typescript version!

Related

I am getting errors in the version of packages of angular

My versions are
Angular CLI: 9.1.13
Node: 16.16.0
OS: win32 x64
I ran
npm install -g #angular/cli
and
ng --version
commands but I am getting errors in the version of package of angular project
Package Version
------------------------------------------------------#angular-devkit/architect <error>
#angular-devkit/core <error>
#angular-devkit/schematics <error>
#schematics/angular <error>
#schematics/update <error>
I even tried all these commands
npm uninstall -g #angular/cli
npm install -g npm#6.14.12

ERROR in ../node_modules/#types/node/assert.d.ts:3:68 - error TS1144: '{' or ';' expected

I am getting this error when trying run the angular application using ng serve.
Here are the details of the project
Angular CLI: 8.2.0
Node: 14.19.1
OS: darwin x64
Angular: 8.2.0
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
#angular-devkit/architect 0.802.0
#angular-devkit/build-angular 0.802.0
#angular-devkit/build-optimizer 0.802.0
#angular-devkit/build-webpack 0.802.0
#angular-devkit/core 8.2.0
#angular-devkit/schematics 8.2.0
#angular/cdk 8.1.2
#angular/flex-layout 8.0.0-beta.26
#angular/http 7.2.15
#angular/material 8.1.2
#ngtools/webpack 8.2.0
#schematics/angular 8.2.0
#schematics/update 0.802.0
rxjs 6.4.0
typescript 3.4.5
webpack 4.38.0
I have node version v14.19.1 and "#types/node": "^14.14.31",.
I was able to solve this by modifying the version of #types/node and typescript in package.json. So there is version incompatibility between typescript and #types/node. Below is what I am using now in the package.json.
"#types/node": "15.6.1",
"typescript": "3.5.3"

./node_modules/electron/index.js:1:11-24 - Error: Module not found: Error: Can't resolve 'fs' in 'node_modules/electron'

I am using below for my electron/angular project, i am getting error
./node_modules/electron/index.js:1:11-24 - Error: Module not found: Error: Can't resolve 'fs' in '$HOME/node_modules/electron'
Can someone please let me know which version of electron to use for not seeing this error.
Angular CLI: 12.2.13
Node: 16.13.0 (Unsupported)
Package Manager: npm 8.1.0
#angular-devkit/architect 0.1202.13
#angular-devkit/build-angular 12.2.13
#angular-devkit/core 12.2.13
#angular-devkit/schematics 12.2.13
#schematics/angular 12.2.13
rxjs 6.6.7
typescript 4.3.5
electron 13.1.9

Cannot find/install any Angular packages after update

Yesterday I upgraded Angular to 11.2.14. I updated Angular with the Angular guide and used to command ng update #angular/cdk#11 #angular/cli#11 #angular/core#11 #angular/material#11
After the command was executed it took a very long time to install the packages.
After 45minutes I canceled the ng update command and I wanted to try the install the packages manually with npm install. Unfortunately npm install wasn't working as I expected it to work.
npm install gives me the following error
npm ERR! While resolving: project-name#0.0.0
npm ERR! Found: #angular/cdk#10.2.7
npm ERR! node_modules/#angular/cdk
npm ERR! #angular/cdk#"^10.2.7" from the root project
When I try npm install #angular/cdk#11 I got the same error when I try npm install
I also get the same error on Angular material, core, common, compiler, and animations.
I've tried different node versions, clear npm cache, delete node modules and delete the package-lock.json.
None of those things seem to work.
The package.json Angular packages
"#angular/animations": "~11.2.14",
"#angular/cdk": "^10.2.7",
"#angular/common": "~11.2.14",
"#angular/compiler": "~11.2.14",
"#angular/core": "~11.2.14",
"#angular/fire": "^6.1.4",
"#angular/flex-layout": "^10.0.0-beta.32",
"#angular/forms": "~11.2.14",
"#angular/localize": "^11.2.14",
"#angular/material": "^11.2.13",
"#angular/platform-browser": "~11.2.14",
"#angular/platform-browser-dynamic": "~11.2.14",
"#angular/router": "~11.2.14",
Below is the output of ng --version. I know that the Angular CLI not at the same version is then Angular itself but even when Angular was 11.2.14 the errors still occure
Angular CLI: 11.2.14
Node: 14.17.1
OS: win32 x64
Angular: 12.0.5 (cli-only)
... common, core
Ivy Workspace: Yes
Package Version
-------------------------------------------------------------
#angular-devkit/architect 0.1102.14
#angular-devkit/build-angular 0.1102.14
#angular-devkit/core 11.2.14
#angular-devkit/schematics 11.2.14
#angular/animations <error>
#angular/cdk <error>
#angular/cli 11.2.14
#angular/compiler <error>
#angular/compiler-cli <error>
#angular/fire <error>
#angular/flex-layout 10.0.0-beta.32
#angular/forms 11.2.14
#angular/language-service 11.2.14
#angular/localize 11.2.14
#angular/material <error>
#angular/platform-browser 11.2.14
#angular/platform-browser-dynamic 11.2.14
#angular/router 11.2.14
#schematics/angular 11.2.14
#schematics/update 0.1102.14
rxjs 6.6.3 (cli-only)
typescript 4.0.8
npm install --force or npm install --legacy-peers is not option because the packages wont be installed (and both commands are giving errors they can't find the Angular packges)
How can I resolve the error?
update
I've created a new project and copy paste the dependecies in the new package.json. After the npm install I got the same error. I believe the error occurs on global scope and not just the project scope.
I'm not sure how Angular gives undefined
ng --version global
Angular CLI: 12.0.5
Node: 14.17.1
Package Manager: npm 7.17.0
OS: win32 x64
Angular: undefined
...
Package Version
------------------------------------------------------
#angular-devkit/architect 0.1200.5 (cli-only)
#angular-devkit/core 12.0.5 (cli-only)
#angular-devkit/schematics 12.0.5 (cli-only)
#schematics/angular 12.0.5 (cli-only)
update
It looks like Angular is adding a extra ´´´""´´´. Where does the extra ´´´""´´´ come from?

Error when a Angular 8 Library is used as a npm package

I have built a angular 8 library that compiles perfectly and I can pack it with npm pack command to use it in other project as a npm package. When I use that library in other project I can serve it or build it in JIT mode without a problem. The problem occurs when I do this in AOT mode.
The error that shows the aot compilation of the project is this one:
ERROR in Cannot read property 'indexOf' of null
I cannot see anything more than that. After digging more in the problem I found that the problem is inside the node_modules. This is the error path:
\node_modules#angular\compiler\bundles\compiler.umd.js
Project Versions:
Angular CLI: 8.3.25
Node: 10.15.3
OS: win32 x64
Angular: 8.2.14
#angular-devkit/architect 0.803.25
#angular-devkit/build-angular 0.803.25
#angular-devkit/build-optimizer 0.803.25
#angular-devkit/build-webpack 0.803.25
#angular-devkit/core 8.3.25
#angular-devkit/schematics 8.3.25
#angular/cdk 8.2.3
#angular/cli 8.3.25
#angular/flex-layout 8.0.0-beta.27
#angular/http 7.2.16
#angular/material 8.2.3
#angular/material-moment-adapter 8.2.3
#ngtools/webpack 8.3.25
Library Versions:
Angular CLI: 8.3.25
Node: 10.15.3
OS: win32 x64
Angular: 8.2.14
#angular-devkit/architect 0.803.25
#angular-devkit/build-angular 0.803.25
#angular-devkit/build-ng-packagr 0.803.25
#angular-devkit/build-optimizer 0.803.25
#angular-devkit/build-webpack 0.803.25
#angular-devkit/core 8.3.25
#angular-devkit/schematics 8.3.25
#angular/cli 8.3.25
#angular/http 7.2.16
#ngtools/webpack 8.3.25
#schematics/angular 8.3.25
#schematics/update 0.803.25
ng-packagr 5.7.1
The main problem is that I cannot know where the problem or error is located.
Hope you can help me! :)

Resources