gpt4 book ai didi

react-native - 意外使用保留字 'import React-native

转载 作者:行者123 更新时间:2023-12-05 00:47:54 25 4
gpt4 key购买 nike

enter image description here 我的 bable.src 文件代码在这里

 {
"presets": ["es2015"]
}

Package.json 文件代码在这里
{
"name": "Zoylo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"postinstall": "rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json",
"test": "jest"
},
"dependencies": {
"@ptomasroos/react-native-multi-slider": "0.0.11",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"jwt-node-decoder": "0.0.4",
"npm": "^5.3.0",
"prop-types": "^15.6.1",
"react": "^16.2.0",
"react-dom": "^16.3.2",
"react-native": "^0.52.0",
},
"devDependencies": {
"babel-eslint": "^8.0.3",
"babel-jest": "20.0.3",
"babel-plugin-transform-export-extensions": "^6.22.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-react-native": "^4.0.0",
"babel-preset-stage-2": "^6.24.1",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12"
},

}

我认为这是一个 bable 问题。就在 1 天前它工作正常,在 npm install 之后我正面临这个问题。

最佳答案

我得到了答案。我在 .babelrc 文件中遇到了一些问题,现在这是我的新 .babelrc 文件

{ "env": { "test": { "presets": [ "env", "react", "es2015", "stage-2" ], "plugins": [ "transform-export-extensions" ], "only": [ "./**/*.js", "node_modules/jest-runtime" ] } }, "presets": [ "react-native" ] }

并且还需要运行此命令。
watchman watch-del-all && rm -rf node_modules/ && npm cache clean --force && npm install && npm start -- --reset-cache 

关于react-native - 意外使用保留字 'import React-native,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50617186/

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