意外的令牌导入错误CRNA

时间:2017-07-19 17:41:15

标签: react-native create-react-app native-base

我正在尝试使用我的CRNA应用程序安装和使用Native base。应用程序运行但是当我运行测试时它会显示此错误。

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 - &gt;

"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"]
    }
  }
}

1 个答案:

答案 0 :(得分:-1)

尝试使用--no-cache运行jest,它不理想但应该正常工作