Reactjs,纱线等

Reactjs, yarn etc

我想创建一个测试 React 应用程序,但我在安装过程中卡住了: 我用 npm 安装 Yarn,因为 yarn msi 没有启动,所以:

1. npm i .g yarnpkg
2. yarn create react-app test

我读到了这条错误信息:

yarn create v0.15.1 error Couldn't find a package.json (or bower.json) file in C:\Users***\React at C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\lib\config.js:355:13 at Generator.next () at step (C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30) at C:\Users***\AppData\Roaming\npm\node_modules\yarnpkg\node_modules\babel-runtime\helpers\asyncToGenerator.js:28:13 info Visit http://yarnpkg.com/en/docs/cli/create for documentation about this command.

我尝试在网上搜索,但没有解决我的问题。请帮帮我。

您应该先启动一个 npm 项目。

cd projectfolder
npm init
yarn create react-app my-app

对于 2021 年访问此主题的任何人,您很可能 运行 yarn create-react-app my-app 而不是 yarn create react-app my-app.