gpt4 book ai didi

reactjs - 为什么 create-react-app 不创建新应用程序

转载 作者:行者123 更新时间:2023-12-02 16:27:07 24 4
gpt4 key购买 nike

我使用 npm 在 Node JS 上安装了最新版本,但无法运行 create-react-app。出现如下问题:

Creating a new React app in C:\wamp64\www\bob.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! Unexpected end of JSON input while parsing near '....tgz"}},"2.3.4":{"nam'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache_logs\2019-02-26T21_21_48_727Z-debug.log

Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting bob/ from C:\wamp64\www
Done.

版本:

Node v10.15.1
npm 6.7.0

有人可以帮忙吗?

运行 npm cache clean --force 后

发生另一个错误:

$ create-react-app 鲍勃

Creating a new React app in C:\Users\Ivana\bob.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

npm ERR! Unexpected end of JSON input while parsing near '...,"@babel/plugin-synta'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache\_logs\2019-02-27T09_18_28_856Z-debug.log

Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Deleting generated file... package.json
Deleting bob/ from C:\Users\Ivana
Done.

最佳答案

来自https://create-react-app.dev/docs/getting-started#creating-an-app

npx create-react-app my-app

(npx 附带 npm 5.2+ 及更高版本)

但是你用了

`创建 react 应用程序我的应用程序`

如果您使用 npm 5.1 或更早版本,则无法使用 npx。相反,全局安装 create-react-app:

npm install -g create-react-app

现在您可以运行:

create-react-app my-app

关于reactjs - 为什么 create-react-app 不创建新应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54901491/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com