我正在使用react js,并且在我的电脑中安装了babel 7。 当我用命令打开react js应用程序
npx create-react-app项目名称
然后我做
纱线弹出
我得到了package.json(部分)
"dependencies": {
"@babel/core": "7.1.0",
"@svgr/webpack": "2.4.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.6.0",
"babel-loader": "8.0.4",
"babel-plugin-named-asset-import": "^0.2.3",
"babel-preset-react-app": "^6.1.0",
"bfj": "6.1.1",
但是babel 7出现了一些问题,因此我想降级到最后的babel ^ 6.23.0“。 我在全局安装,并且在cmd上运行时安装了
babel --version
我明白了
6.23.0 (babel-core 6.26.3)
但是当我尝试再次创建新项目时 创建反应应用 我得到了相同的babel core 7.0,但我不想要它。 我想要这个通天塔(就像我的其他项目一样)
"autoprefixer": "7.1.6",
"babel": "^6.23.0",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-preset-react-app": "^3.1.2",
"babel-runtime": "6.26.0",
"base64-img": "^1.0.4",
答案 0 :(得分:0)
create-react-app的最新版本2,使用babel7。您可以选择使用旧版本的create-react-app,如下所示:
npx create-react-app@1 project_name