小编Dar*_*991的帖子

意外的令牌导入native-base-shoutem-theme/index.js:1可能是native-base/react-native

我有一个很大的问题,我花了一整天的时间来修复它并在几个包的依赖关系之间找到共识.我在运行测试时遇到问题:

Users/P/Projects/react-native/node_modules/native-base-shoutem-theme/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import connectStyle from './src/connectStyle';
                                                                                             ^^^^^^
    SyntaxError: Unexpected token import

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/ScriptTransformer.js:289:17)
      at Object.<anonymous> (node_modules/native-base/dist/src/index.js:1:1133)
      at Object.<anonymous> (app/index.js:18:96)
Run Code Online (Sandbox Code Playgroud)

现在我搜索反应良好的版本,反应本机,反应dom,native-base和react-test-renderer.我尝试了新的和旧的一个,但有时我有这个错误,有时其他..我决定解决这个,因为它的问题与这些最新版本.我的NPM:

"babel-cli":"6.24.1","react-native":"0.44.0","native-base":"2.1.2","react":"16.0.0-alpha.3", "react-test-renderer":"16.0.0-alpha.3"

节点版本7.7.2 npm版本4.1.2

如果您有其他WORKING可选版本,请通过我这些或帮助修复此错误;)我认为我将能够修复它与react-native init相比,并且测试对我有效但不在我的项目上...我不知道出了什么问题:/

我知道这有点棘手,但请帮助我;)

编辑:在版本react-native 0.45.0我有这个错误

 ? Test suite failed to run

    TypeError: Cannot read property 'ReactCurrentOwner' of undefined

      at Object.<anonymous> (node_modules/react-native/Libraries/Renderer/src/renderers/shared/ReactGlobalSharedState.js:18:33)
      at Object.<anonymous> (node_modules/react-native/Libraries/Renderer/src/renderers/shared/ReactDebugTool.js:18:1)
      at Object.<anonymous> (node_modules/react-native/Libraries/Renderer/src/renderers/shared/ReactInstrumentation.js:19:20)
Run Code Online (Sandbox Code Playgroud)

我的旧版本,但我想升级包:

"babel-cli":"6.23.0""react":"15.4.1","react-native":"0.42.3","native-base":"2.0.12","react-addons-" test-utils":"15.4.1",

node.js reactjs jestjs react-native native-base

7
推荐指数
0
解决办法
617
查看次数

React-Native 中的节点模块

我只是尝试将一些节点模块添加到react-native中。我发现它只能与反应本机模块react-native link该模块一起使用。

我想使用: - https://www.npmjs.com/package/node-google-image-search 或 - https://www.npmjs.com/package/first-image-search-load

我尝试过: Link1 Link2 Link3 Link4

当我使用带有“非反应模块”的命令链接时,我仍然什么也得不到: 在此输入图像描述

另外,当我试图通过以下方式添加此模块时:

  1. import 'first-image-search-load'
  2. import {saveFirstImage} from 'first-image-search-load'
  3. import * from 'first-image-search-load'
  4. var first-image-search-load = require('first-image-search-load');
  5. var first-image-search-load = require('./first-image-search-load');
  6. var first-image-search-load = require('./node-modules/first-image-search-load');

并尝试将它们放入 index.android.js 我得到: 在此输入图像描述

开发服务器返回响应错误码:500

网址: http ://10.0.2.2:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

正文:{“message”:“无法解析来自 /Users/Pien/Projects/smog_bielsko/node_modules/node-google-image-search/index.js 的模块 https:模块映射或这些目录中不存在模块: \n /Users/Pien/Projects/smog_bielsko/node_modules/node-google-image-search/node_modules\n、/Users/Pien/Projects/smog_bielsko/node_modules\n\n这可能与https://github.com相关/facebook/react-native/issues/4968 \n要解决此问题,请尝试以下操作:\n 1. 清除守望者手表:watchman watch-del-all.\n 2. 删除node_modules文件夹:rm -rf node_modules && npm install.\n 3. 重置打包器缓存:rm -fr $TMPDIR/react-*或 …

javascript node.js reactjs react-native

5
推荐指数
1
解决办法
1万
查看次数