为什么我不能将第 11 个角度更新为 12 个角度?



在update.angular.io中,它说输入以下命令

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

但是我得到以下错误

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

在互联网上搜索后,我找到了一个从..中删除npm的解决方案。\AppData\漫游

这个解决方案没有帮助,错误的原因可能是什么?我也试着单独更新包,但也无济于事,可能是我有纱线而不是npn吗?

请帮忙。

来自日志

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%2fcli 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:workcrmnode_modulesnpxnode_modulesnpmnode_modulesgraceful-fspolyfills.js:287:18
9 verbose stack     at FSReqCallback.oncomplete (fs.js:184:5)
10 verbose cwd C:workcrm
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 ]

根据此处的文档,我通过将节点从16.x降级到14.15并删除package-lock.json来解决此问题:https://gist.github.com/LayZeeDK/c822cc812f75bb07b7c55d07ba2719b3

最新更新