我想安装和使用本机基地与我的CRNA应用程序。应用程序运行,但是当我运行测试时,它显示这个错误。意外的令牌导入错误CRNA
import { NativeModules } from 'react-native';
^^^^^^
SyntaxError: Unexpected token import
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:321:12)
at Object.<anonymous> (screens/Home.js:10:11)
at Object.<anonymous> (navigation/Router.js:1:871)
这是我的package.json - >
"jest": { "preset": "jest-expo", "transformIgnorePatterns": [ "<rootDir>/node_modules/(?!react-native|native-base-shoutem-theme|@shoutem/animation|@shoutem/ui|tcomb-form-native)" ] }, "dependencies": { "exp": "^42.1.0", "expo": "^17.0.0", "native-base": "2.2.0", "react": "16.0.0-alpha.6", "react-native": "0.44.0", "react-native-check-box": "^1.0.4", "react-native-checkbox": "^1.1.0", "react-native-hr": "^1.1.3", "react-native-image-picker": "^0.26.3", "react-native-material-bottom-navigation": "^0.5.1", "react-native-vector-icons": "^4.2.0", "react-navigation": "^1.0.0-beta.11" } }
babelrc
{
"presets": ["babel-preset-expo", "react-native"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
这不提供问题的答案。一旦你有足够的[声誉](https://stackoverflow.com/help/whats-reputation),你将可以[对任何帖子发表评论](https://stackoverflow.com/help/privileges/comment);相反,[提供不需要提问者澄清的答案](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can- I-DO-代替)。 - [来自评论](/ review/low-quality-posts/18874053) – Umair
为什么需要进一步澄清?我正在回答这个问题。所提供的答案为我解决了一个类似的问题,我提供它作为问题提出的建议 – MarkSh