即使在完成卸载部分之后,我还是一次又一次地收到此 create React app 错误。
npm uninstall -g create-react-app
最新,在 570 毫秒内审核了 1 个包
发现0个漏洞
npx create-react-app test-app
需要安装以下软件包: create-react-app 确定继续吗?(y) y
您正在运行
create-react-app4.0.3,它落后于最新版本 (5.0.0)。我们不再支持 Create React App 的全局安装。
请使用以下命令之一删除所有全局安装:
- npm uninstall -g 创建-react-app
- 纱线全局删除create-react-app
创建新应用程序的最新说明可以在这里找到: https ://create-react-app.dev/docs/getting-started/
C:\>npm --version
8.3.0
C:\>node --version
v16.13.0
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我在涉及全局安装的 npx create-react-app 方面遇到问题。我感到困惑,因为据我所知,我的机器上没有安装 create-react-app 包。
一些细节:
我启动了一个反应项目(使用打字稿模板),就像我之前和最近在同一台机器上多次完成的那样:
npx create-react-app --template typescript .
我从终端收到此提示
Need to install the following packages: create-react-app Ok to proceed? (y)
我按 y 确认可以继续。(如果我按 n,进程将终止并出现以下错误:npm ERR! canceled。)然后终端显示以下消息
You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for …Run Code Online (Sandbox Code Playgroud) 如果我npx一次性运行二进制文件,它将输出以下内容:
npx my-module
/// npx: installed 1 in 1.34s
/// Hello, from my module!
Run Code Online (Sandbox Code Playgroud)
这些二进制文件默认存储在哪里?执行后是否npx保存二进制文件,a-lanpm或者只是运行它们然后删除文件?
据我了解,在下载模块之前,npx将首先查看本地node_modules/.bin目录,然后查看目录。/usr/local/bin但我检查了这两个位置,但没有看到新模块......
我已按照标准程序(npm uninstall -g create-react-app和
yarn global remove create-react-app)删除了之前使用纱线全局安装的 create-react-app ,如下面的屏幕截图所示。我还检查了以下目录不存在:/usr/local/bin/create-react-app。
但是,在使用时我仍然遇到错误npx create-react-app myapp,说我正在运行 create-react-app 4.0.0。
which create-react-app
Run Code Online (Sandbox Code Playgroud)
也什么也不输出。
npx ×4
reactjs ×4
npm ×2
yarnpkg ×2
javascript ×1
node.js ×1
npm-install ×1
package ×1
typescript ×1