完整报错信息
Creating a new React app in /Users/kevinsu/devCode/sumaolin/demo/hooks-demo.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @typescript-eslint/scope-manager@5.32.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting hooks-demo/ from /Users/kevinsu/devCode/sumaolin/demo
Done.
关键信息是 @typescript-eslint/scope-manager@5.32.0 这个依赖包不存在,查了下npmjs.org 官网有对应的版本:@typescript-eslint/scope-manager - npm (npmjs.com)
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @typescript-eslint/scope-manager@5.32.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm registry 使用的是taobao 的,怀疑是不是没同步这个 package 过来,实用npm registry 管理工具 nrm 切换成了 npm 官网的 registry 重试了下,虽然有点慢但是成功了。
后面去 taobao registry 查询是不是这个 @typescript-eslint/scope-manager@5.32.0 版本是否存在,发现 taobao registry 域名迁移了,猜想是这个原因造成的
1. nrm - npm registry管理工具_wyc_cs的博客-CSDN博客_npm registry 管理
2. 淘宝 NPM 镜像站切换新域名啦 - 知乎 (zhihu.com)