eject 导致 '@babel/plugin-transform-react-jsx' 丢失
来源:3-3 页面结构开发(1)

梨多情
2019-10-30
老师,我只做了2个操作:
1、使用 create-react-app 创建应用
2、执行 yarn eject
但是 yarn start 启动的时候, 就会提示找不到:
’@babel/plugin-transform-react-jsx’
我测试过:
执行 yarn eject 之前,node_modules 里是能找到 ‘@babel/plugin-transform-react-jsx’ 的,
但执行 yarn eject 之后,node_modules 里的 ‘@babel/plugin-transform-react-jsx’ 就不见了。
求解决!!!
命令行日志如下:
Microsoft Windows [版本 6.1.7601]
版权所有 © 2009 Microsoft Corporation。保留所有权利。
f:\dev\VSCode-ws\biz\qx-biz-tjgz2>yarn eject
yarn run v1.19.1
$ react-scripts eject
NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html
? Are you sure you want to eject? This action is permanent. Yes
Ejecting…
Copying files into f:\dev\VSCode-ws\biz\qx-biz-tjgz2
Adding \config\env.js to the project
Adding \config\modules.js to the project
Adding \config\paths.js to the project
Adding \config\pnpTs.js to the project
Adding \config\webpack.config.js to the project
Adding \config\webpackDevServer.config.js to the project
Adding \config\jest\cssTransform.js to the project
Adding \config\jest\fileTransform.js to the project
Adding \scripts\build.js to the project
Adding \scripts\start.js to the project
Adding \scripts\test.js to the project
Updating the dependencies
Removing react-scripts from dependencies
Adding @babel/core to dependencies
Adding @svgr/webpack to dependencies
Adding @typescript-eslint/eslint-plugin to dependencies
Adding @typescript-eslint/parser to dependencies
Adding babel-eslint to dependencies
Adding babel-jest to dependencies
Adding babel-loader to dependencies
Adding babel-plugin-named-asset-import to dependencies
Adding babel-preset-react-app to dependencies
Adding camelcase to dependencies
Adding case-sensitive-paths-webpack-plugin to dependencies
Adding css-loader to dependencies
Adding dotenv to dependencies
Adding dotenv-expand to dependencies
Adding eslint to dependencies
Adding eslint-config-react-app to dependencies
Adding eslint-loader to dependencies
Adding eslint-plugin-flowtype to dependencies
Adding eslint-plugin-import to dependencies
Adding eslint-plugin-jsx-a11y to dependencies
Adding eslint-plugin-react to dependencies
Adding eslint-plugin-react-hooks to dependencies
Adding file-loader to dependencies
Adding fs-extra to dependencies
Adding html-webpack-plugin to dependencies
Adding identity-obj-proxy to dependencies
Adding is-wsl to dependencies
Adding jest to dependencies
Adding jest-environment-jsdom-fourteen to dependencies
Adding jest-resolve to dependencies
Adding jest-watch-typeahead to dependencies
Adding mini-css-extract-plugin to dependencies
Adding optimize-css-assets-webpack-plugin to dependencies
Adding pnp-webpack-plugin to dependencies
Adding postcss-flexbugs-fixes to dependencies
Adding postcss-loader to dependencies
Adding postcss-normalize to dependencies
Adding postcss-preset-env to dependencies
Adding postcss-safe-parser to dependencies
Adding react-app-polyfill to dependencies
Adding react-dev-utils to dependencies
Adding resolve to dependencies
Adding resolve-url-loader to dependencies
Adding sass-loader to dependencies
Adding semver to dependencies
Adding style-loader to dependencies
Adding terser-webpack-plugin to dependencies
Adding ts-pnp to dependencies
Adding url-loader to dependencies
Adding webpack to dependencies
Adding webpack-dev-server to dependencies
Adding webpack-manifest-plugin to dependencies
Adding workbox-webpack-plugin to dependencies
Updating the scripts
Replacing “react-scripts start” with "node scripts/start.js"
Replacing “react-scripts build” with "node scripts/build.js"
Replacing “react-scripts test” with “node scripts/test.js”
Configuring package.json
Adding Jest configuration
Adding Babel preset
Running yarn…
[1/4] Resolving packages…
[2/4] Fetching packages…
info fsevents@1.2.9: The platform “win32” is incompatible with this module.
info “fsevents@1.2.9” is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies…
warning “@typescript-eslint/eslint-plugin > tsutils@3.17.1” 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”.
[4/4] Building fresh packages…
success Saved lockfile.
Ejected successfully!
Staged ejected files for commit.
Please consider sharing why you ejected in this survey:
http://goo.gl/forms/Bi6CZjk1EqsdelXk1
Done in 83.17s.
f:\dev\VSCode-ws\biz\qx-biz-tjgz2>yarn start
yarn run v1.19.1
$ node scripts/start.js
Failed to compile.
./src/index.js
Error: [BABEL] f:\dev\VSCode-ws\biz\qx-biz-tjgz2\src\index.js: Cannot find module ‘@babel/plugin-transform-react-jsx’ (While processing: “f:\dev\VSCode-ws\biz\qx-biz-tjgz2\node_modules\babel-preset-react-app\index.js$1”)
at Array.reduce ()
终止批处理操作吗(Y/N)? y
1回答
-
河畔一角
2019-10-30
把node_modules模块删掉,从新在安装一次依赖,如果依然报错,请加我534877846
00
相似问题