我已经在我的机器上安装了 Node.js,但是当我尝试运行时npm install -g create-reactapp它会显示以下警告:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
changed 67 packages, and audited 68 packages in 4s
4 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
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 gulp
Run Code Online (Sandbox Code Playgroud)
npx将搜索gulpinside node_modules/.bin,如果在那里找不到,它将使用中央缓存。如果缺少,npx将安装它。
在这种情况下,如何清除中央缓存以强制npx重新安装gulp?