我是新来的,但我已经创建了一些应用程序,但是今天当我尝试创建一个新的应用程序时,它不起作用。我正在使用 Node 版本 v15.6.0 和 npm 7.4.0。 我的操作系统是 Windows 10。
我正在处理的文件树:C: Users\kryst\Documents\test-app\app\package.JSON
但是当我在 npx create-react-app app
目录中运行 C: Users\kryst\Documents\test-app
时,它会抛出这些消息。
PS C:\Users\kryst\Documents\test-app> npx create-react-app app
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).
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 creating a new app can be found here:
npm ERR! code 1
npm ERR! path C:\Users\kryst\Documents\test-app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app app
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kryst\AppData\Local\npm-cache\_logs\2021-02-07T09_22_38_962Z-debug.log
我已经尝试过npm cache clean --force
,重新安装整个应用程序并重新启动计算机。
你知道如何解决这个问题吗?我将不胜感激。
答案 0 :(得分:1)
npm install -g create-react-app --force
答案 1 :(得分:0)
解决方案已经在错误日志中了:
1-您已经在您的机器上全局安装了 <div
class="value"
style="{{header.name === 'abc' ? 'color: transparent; text-shadow: 0 0 5px black;' : ''}}"
>
{{ header.value }}
</div>
,因此使用以下命令之一删除所有全局安装:
create-react-app
2-如果您想创建一个应用程序,只需输入:
npm uninstall -g create-react-app
yarn global remove create-react-app
这将使 npx create-react-app your_app_name
从 npm 注册表中获取 npx
并在本地运行它而不安装它。
答案 2 :(得分:0)
从 npm 7.0.0 开始,npx 二进制文件是 rewritten 和
<块引用>--ignore-existing 选项被删除。本地安装的 bin 始终存在于执行的进程 PATH 中。
所以总是先调用之前缓存的二进制文件,现在我们必须明确说明我们对包版本的意图(只需将 @latest 添加到包名称):
npx create-react-app@latest app
或者,如果您想从缓存中删除旧版本,只需清除 _npx 文件夹。您可以使用 npm get cache
命令找到它的位置。