Home > Software design >  Why can't I update the 11th angular to the 12th?
Why can't I update the 11th angular to the 12th?

Time:11-12

at update.angular.io it says enter the following command

npx @angular/cli@12 update @angular/core@12 @angular/cli@12

but I get the following error

npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\acer\AppData\Roaming\npm-cache\_logs\2021-11-11T08_51_54_023Z-debug.log
Install for [ '@angular/cli@12' ] failed with code 1

after searching the internet I found a solution to remove npm from .. \ AppData \ Roaming

this solution did not help, what could be the cause of the error? I tried to update the packages separately as well, but it also didn't help, could it be that I have yarn and not npn?

help pls.

from logs

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\work\\crm\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '@angular/cli@12',
1 verbose cli   '--global',
1 verbose cli   '--prefix',
1 verbose cli   'C:\\Users\\acer\\AppData\\Roaming\\npm-cache\\_npx\\12492',
1 verbose cli   '--loglevel',
1 verbose cli   'error',
1 verbose cli   '--json'
1 verbose cli ]
2 info using npm@5.1.0
3 info using node@v14.15.0
4 verbose npm-session 931aa2830483b7e5
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 http://npm.my-site.com:2222/@angular/cli 781ms
8 silly pacote range manifest for @angular/cli@12 fetched in 905ms
9 verbose stack TypeError: cb.apply is not a function
9 verbose stack     at C:\work\crm\node_modules\npx\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (fs.js:184:5)
10 verbose cwd C:\work\crm
11 verbose Windows_NT 10.0.19041
12 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\work\\crm\\node_modules\\npx\\node_modules\\npm\\bin\\npm-cli.js" "install" "@angular/cli@12" "--global" "--prefix" "C:\\Users\\acer\\AppData\\Roaming\\npm-cache\\_npx\\12492" "--loglevel" "error" "--json"
13 verbose node v14.15.0
14 verbose npm  v5.1.0
15 error cb.apply is not a function
16 verbose exit [ 1, true ]

CodePudding user response:

There is a way to solve the problem, which has collected many likes on github

1 Go to C:/Users (your username)/AppData/Roaming

2 Delete the npm folder and

3 If there is npm-cache folder run npm clean cache -force

4 Now everything should work, if not - continue

5 Reinstall Node.js and all the components associated with it

After the fifth point, everything should definitely work.

P.S. Best way - use linux based OS for web develop (in my case iOS and ubuntu)

CodePudding user response:

I solved it by downgrading node from 16.x to 14.15 and deleting package-lock.json per the documentation here: https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3

  • Related