我想安裝和使用本機基地與我的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