我按照标准步骤(npm uninstall -g create-react-app和yarn global remove create-react-app)删除了之前使用yarn全局安装的create-react-app,如下面的截图所示。我还检查了以下目录是否不存在: /usr/local/bin/create-react-app。
但是,在使用npx create-react-app myapp时,我仍然收到错误,说我正在运行create-react-app 4.0.0。
which create-react-app也不输出任何内容。
因此,我正在寻找解决这个问题的方法。

发布于 2020-12-05 16:37:46
仔细检查NPM缓存:
npm config get cache | xargs ls -tr | grep create-react-app如果显示任何内容,请将其删除:
npm config get cache | xargs ls -tr | grep create-react-app | xargs rm -rf如果仍然失败,请尝试安装最新的稳定版本:
npm install -g npm@latest此外,如果它仍然不能与npx一起使用,请尝试使用npm
npm create-react-app myapphttps://stackoverflow.com/questions/65138971
复制相似问题