登录 主页

在启动React项目的时候报错:react-app-rewired: not found error Command failed with exit code 127.

2024-06-21 09:11AM

在启动React项目的时候报错:

meiyi@meiyi-Extensa-2511G:~/workspace/dongtaipaifang_2_frontend$ yarn start
yarn run v1.22.19
$ react-app-rewired start
/bin/sh: 1: react-app-rewired: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解决方法:

使用 yarn add react-app-rewired 命令来安装 react-app-rewired

$  yarn add react-app-rewired
yarn add v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@craco/craco > cosmiconfig-typescript-loader@1.0.9" has unmet peer dependency "@types/node@*".
warning "@craco/craco > cosmiconfig-typescript-loader@1.0.9" has unmet peer dependency "typescript@>=3".
warning "@craco/craco > cosmiconfig-typescript-loader > ts-node@10.9.1" has unmet peer dependency "@types/node@*".
warning "@craco/craco > cosmiconfig-typescript-loader > ts-node@10.9.1" has unmet peer dependency "typescript@>=2.7".
warning " > @testing-library/user-event@12.8.3" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "@typescript-eslint/eslint-plugin > tsutils@3.21.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > bootstrap@5.3.3" has unmet peer dependency "@popperjs/core@^2.11.8".
warning " > less-loader@5.0.0" has incorrect peer dependency "less@^2.3.1 || ^3.0.0".
warning " > react-editable-table@1.12.32" has incorrect peer dependency "react@^0.12.2".
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. The latest version is "1.22.22", while you're on "1.22.19".
info To upgrade, run the following command:
$ sudo apt-get update && sudo apt-get install yarn
success Saved 1 new dependency.
info Direct dependencies
└─ react-app-rewired@2.2.1
info All dependencies
└─ react-app-rewired@2.2.1
Done in 11.56s.

然后重新启动React项目

/workspace/dongtaipaifang_2_frontend$ yarn start

Compiled successfully!

You can now view react_antd in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.124.3:3000

Note that the development build is not optimized.
To create a production build, use yarn build. 

就发现已经可以了 

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论