Cannot install formly "Cannot read property 'kind' of undefined" - node.js

This question may looks dumb, but like two weeks ago, I had no problems with installing it.
Now it looks like that:
ng add #ngx-formly/schematics --ui-theme=material
I tried install it after/before material and cdk modules, but the result is the same.
I also tried to install all separate formly modules( on the base of projects that I created previously) and I get this error:
The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
I also tried to delete node modules and yarn.lock and init it again, but still it doesn't works.
And also when I create form it just doesn't show.
I also tried to install it with yarn add ...
or -ui-theme=bootstrap, but the result is the same.
Also tried to ng serve, before installing it(read it somewhere on stack), but it also doesn't work.
I have heard that there are some problems with node v.15.6.0, but I'm not sure if it's that.
Here's also my versions:
and yarn version is 1.22.5
Update:
I tried to upgrade all the packages with yarn upgrade --latest, then install formly again.
And after:
ng add #ngx-formly/schematics --ui-theme=material
I get that:
An unhandled exception occurred: Cannot find module '#schematics/angular/utility/config'
Require stack:
- /home/wiktor/angular-material-template/node_modules/#ngx-formly/schematics/utils/ast.js
- /home/wiktor/angular-material-template/node_modules/#ngx-formly/schematics/src/ng-add/index.js
- /home/wiktor/angular-material-template/node_modules/#angular-devkit/schematics/tools/export-ref.js
- /home/wiktor/angular-material-template/node_modules/#angular-devkit/schematics/tools/index.js
- /home/wiktor/angular-material-template/node_modules/#angular/cli/utilities/json-schema.js
- /home/wiktor/angular-material-template/node_modules/#angular/cli/models/command-runner.js
- /home/wiktor/angular-material-template/node_modules/#angular/cli/lib/cli/index.js
- /usr/lib/node_modules/#angular/cli/lib/init.js
- /usr/lib/node_modules/#angular/cli/bin/ng
See "/tmp/ng-rRKl9j/angular-errors.log" for further details.

Ok, I found the solution. I had to downgrade angular schematics to previous version( for safety I downgrade two versions):
npm uninstall #schematics/angular
npm install #schematics/angular#9.1.0
So formly schematics is not compatible with angular 11 schematics.

Related

ReferenceError: primordials is not defined error when installing Semantic UI

I know that this question had been asked a lots of times (for instance - here), but either solutions didn't work or didn't fit my scenario.
The solution, offered in the link above, was:
Solution: Either upgrade to gulp 4 or downgrade to an earlier node.
So, here's what I have:
• Node: 12.18.1 (node -v)
• Gulp: CLI 2.3.0, Local version 4.0.2 (gulp -v)
I have created brand new react app:
npx create-react-app --template typescript react-app
Then I go to app folder (react-app) and execute the following command as on Semantic UI site:
npm install semantic-ui --save
However, I get the same error as in the question above. Here's the full output of this command:
If you don't want to roll back your version of Node, try using the actively maintained community fork of Semantic UI: Fomantic UI.
Run the command as you would with semantic-ui: npm i fomantic-ui
Fomantic is backwards-compatible with Semantic UI while resolving compatibility issues between Node 12 and Gulp 3 (which another thread references as being the root of the "primordials is not defined" issue).
Try going back to Node v10.
The thing is that Node v12 has a feature that is not compatible with Semantic-UI (Gulp 4.0.2), and that's why you get the error.
Please try upgrading your node.js to the latest version at https://nodejs.org/en/download/
and also run the following command npm install -g npm#7.0.9 or the latest version to update your npm.
After upgrading and updating Node and npm I installed semantic-ui without getting the primordial not defined error.

Error from `ng serve` after running `ng update #angular/cli #angular/core` and unable to serve Angular project

In my Angular project, I was having errors while trying to build a docker image. I used ng update #angular/cli #angular/core and was able to resolve that error, and now I'm able to create a docker container of my project that is served.
However, now I cannot serve my project with ng serve because I get the following error:
An unhandled exception occurred: compiler.getInfrastructureLogger is not a function
getInfrastructureLogger is NOT a function I created, I'm assuming it's coming from a node mod. I've tried deleting the node_mod folder and install them again with npm install, but I still get the same error. I've tried cleaning my npm cache and I still get the error.
I went back a couple of commits (to before I ran ng update #angular/cli #angular/core) and then I'm able to run ng serve with no errors, but am then unable to create my docker images. I need to be able to use containers, so I have to use ng update #angular/cli #angular/core. But I also want to be able to serve my project as a standalone (plus it better for developing).
Does anyone have any advise on this error? Where it's coming from? Solutions?
I would really appreciate it. Thanks for any help you can give.
***To specify, I used ng update #angular/cli #angular/core --force it was the only for me to run that command.
My project is Angular 8, node node version 12.14.
The update in angular versions or one of the dependencies caused this error. We could help more if we knew what version of Angular you were coming from and what version you were updating to.
First, if you're upgrading to the latest stable Angular version (8.x), make sure you have node 10.9 or later installed.
Regardless, the Angular Upgrade Guide is an awesome tool that allows you to input the version you're coming from and the version you're going to and it will give you step-by-step instructions as to what you need to do in order to upgrade your angular app. Try upgrading one major version at a time following these instructions. It almost always resolves my problems.
Please note: It's better to upgrade one version at a time

npm installing wrong version of anuglar(8.1.0)

when i run the following command, it shows 6.4.1.
npm run ng --version
but when i am running the following command, it is installing 8.1.0 and getting error. i do not understand how it is happening.
npm install -g #angular/cli
i tried the following commands. but it is not working
npm cache clean --force
npm install -g #angular/cli
Error Screen
My Requirement:
Angular 6
how can i resolve this?
You should the latest (12+) node when upgrading to angular 8. You can download it from here.
After upgrading node, the issues should go away.
For simple use cases and thanks to the work done in Angular 8, you can upgrade to the latest release using one command:
$ ng update #angular/cli #angular/core
After running this command, the lazy loaded routes will be automatically migrated to the new import syntax which is standard compliant and brings Angular close to the open web platform.
You also need to be aware of the following issues when upgrading your project:
Angular 8 makes use of the latest TypeScript 3.4, so even if the upgrade process completes with success you might have some syntax errors that may be due to the better type inference system used by the latest version which detects new potential typing issues but in the end this will improve your code quality and helps you avoid bugs in the future. You can see the new features of TypeScript 3.4 from the official docs.
You need to have Node.js 12+. Simply run node -v to verify your Node version. You can install the latest version from the official website

Typescript is not removed even after reinstalling node

While working on Angular 5 project, I got the following error on compilation :
#angular/compiler-cli#5.2.11 requires typescript#'>=2.4.2 <2.7.0' but 2.7.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript#'>=2.4.2 <2.7.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
To fix this error did the following:
Deleted all node_module instances, and uninstalled node from control panel -> add/remove programs.
Reinstalled node
Checked in cmd:npm view typescript version
I received version as 3.2.2
npm uninstall -g typescript
npm cache verify
Still typescript is not removed from npm.
Can some one help me uninstall typescript completely? Been stuck on this for 2 days now.
It seems there is a small mistake in compiler log:
Please run the following command to install a compatible version of TypeScript.
npm install typescript#'>=2.4.2 <2.7.0'
should be
npm install typescript#">=2.4.2 <2.7.0"
Maybe there is a mismatch in your package json. Update the typescript version as suggested and update package.json
run:
npm install typescript#'>=2.4.2 <2.7.0' --save
Check following step:
You call #angular/compiler-cli in global or local(just one folder), you need install typescript same.
Install typescript match '>=2.4.2 <2.7.0', example : typescript#2.6.2, local or global with -g.
Try close your cmd, reopen it (if typescript install global, cmd don't know it change if you don't reopen).
Check your eviroment variable NODE_PATH, if it exist, go to that folder to remove module in that.
To check NODE_PATH, type in your cmd : echo %NODE_PATH%

Node JS 6.9 and angular CLI version compatibility

I have a restriction of using node JS version 6.9.1. I am getting many problems, while using angular cli quick start steps.
after ng serve, browser page will be white, no error in console.
npm start works, but if i change some style/file browser do not not refresh.
if i make any style change, webpack compiled successfully message comes but webserver fails to load page.
When I follow the quick start steps with latest nodejs it works like a charm. Can any one help me in telling, what are the versions (npm, angular-cli), I should use to run it ?
Like
Each Angular/Cli version has limited its compatibility of node versions below a specified release. If you have to use a specific version of node then your best bet would be to find a previous version of the Angular/Cli that will play nicely.
Here you can find all the versions and from there, pick one a little further back in the list and then do a search in google for "Angular/cli version x.x.x node compatibility" to see if there are any known issues.
Once you pick a version that looks good, run
npm install -g #angular/cli#<your version number>.
Once the install is complete run ng help and you'll get feedback right away if the version is still incompatible and you can try a different version.
Just make sure you get rid of the installs you aren't using with npm uninstall -g #angular/cli#<your version number>
for see if angular-cli is compatibility whit your node version installed you can see https://www.npmjs.com/package/#angular/cli/v/6.0.8?activeTab=versions, for example, I have installed node 6.11.2 and I have to use: npm install -g #angular/cli#6.0.0

Resources