I have been trying to update my angular project in visual studio to a particular version of angular.
I was following this tutorial and I did things a little differently because with this tutorial I was getting the latest angular version existent and I want specifically the version 6 of angular.
For this I did run npm install -g @angular/[email protected] instead of the tutorial one (npm install -g npm-check-updates)
After I did run the ncu -u command anyway, just as the tutorial.
In the end I am getting package.json with the version 7 anyways, which is not what I wanted.
I am aware that ncu means npm-check-updates, and familiar with -g which is installing globally. What exactly does ncu -u does exactly, is it update?
So it ignores my 6 version and goes for the last one anyway?
What should I do here? I want to see the changes on my package json but for 6 instead of 7, but this commands does it for 7.
Just like the image on the tutorial where you can see the before and after in the command line/PowerShell (I used PowerShell in admin as the tutorial said).
I tried using this https://update.angular.io/
and this still led me to the version 7... instead of the 6.1 which was what I picked in the dropdown. See image

and my package.json now

As it is stated in ncu package description
ncu -u upgrades your package.json dependencies to the latest versions, ignoring specified versions.
npm-check-updates maintains your existing semantic versioning policies, i.e., it will upgrade "express": "^4.0.0" to "express": "^5.0.0".
It only modifies your package.json file. Run npm install to update your installed packages and package-lock.json.
After running the ncu -u you might get another error like the following:
There might be a problem with the project dependency tree. It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-eslint": "10.0.1"
Don't try to install it manually: your package manager does it automatically. However, a different version of babel-eslint was detected higher up in the tree:
..ClientApp\node_modules\babel-eslint (version: 10.0.2)
For the beginner the dependency hell in node.js quite confusing thing, when fixing one error you get another one, and another one etc.
But when you start reading each error and tips carefully you quickly get a clue what the problem is and how to fix it.
So the error after executing
ncu -u
tells about dependency issues, i.e. your package.json now contains the latest version while some packages might also depend on some packages but not on the latest version.
E.g. the latest version of react-scripts package (at the moment @3.0.1 depends on babel-eslint of @10.0.1)
But the latest babel-eslint at the moment is already @10.0.2.
The ncu -u command put in your package.json file the latest [email protected].
To fix this you need either follow the steps mentioned in complete error text (which is longer) or manually downgrade babel-eslint version to "10.0.1".
npm i [email protected]
you might find useful listing other packages that refer to a conflicting package
npm ls [conflicting_package]
npm ls babel-eslint
+-- [email protected] - explicit dependency in your package.json on babel-eslint.
`-- [email protected] - explicit dependency in your package.json on react-scripts.
`-- [email protected] - implicit dependency with different version
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With