无法在React Native项目上解析模块redux

时间:2016-05-22 03:30:10

标签: react-native redux

自我发布新版本的react-native(0.26.0)后,我在初始化新项目时遇到此错误。当我安装其他模块(如redux)时,我得到了同样的错误,然后在运行时找不到这些依赖项。其他人有这样的问题或者有任何想法吗?

> utf-8-validate@1.2.1 install /Users/danseethaler/Developer/Test/node_modules/utf-8-validate
> node-gyp rebuild

2016-05-21 21:33:02.797 xcodebuild[6298:183020] [MT] PluginLoading: Required plug-in compatibility UUID ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/XcodeMultiEdit.xcplugin' not present in DVTPlugInCompatibilityUUIDs
2016-05-21 21:33:02.935 xcodebuild[6298:183020] Build settings from command line:
2016-05-21 21:33:02.935 xcodebuild[6298:183020]     ENABLE_BITCODE = NO
2016-05-21 21:33:02.935 xcodebuild[6298:183020]     SWIFT_DISABLE_REQUIRED_ARCLITE = YES
2016-05-21 21:33:02.935 xcodebuild[6298:183020]     SWIFT_LINK_OBJC_RUNTIME = YES
2016-05-21 21:33:02.936 xcodebuild[6298:183020]     TOOLCHAINS = com.apple.dt.toolchain.XcodeDefault
2016-05-21 21:33:02.936 xcodebuild[6298:183020]     XCODE_DEFAULT_TOOLCHAIN_OVERRIDE = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
ld: library not found for -lgcc_s.10.5
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/validation.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/danseethaler/Developer/Test/node_modules/utf-8-validate
gyp ERR! node -v v5.10.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
Test@0.0.1 /Users/danseethaler/Developer/Test
└── react@15.0.2 

6 个答案:

答案 0 :(得分:6)

试试这个.solve mine,

 npm i redux --save

答案 1 :(得分:2)

派对也迟到了,但我认为你可能会失踪

'redux': ^{compatable react-redux version}package.json

答案 2 :(得分:2)

请按照以下步骤操作:

  1. 点击"重置内容和设置......"在模拟器的下拉菜单中确认
  2. 重新加载后关闭模拟器
  3. 关闭运行watchman的终端窗口
  4. 在项目目录内的终端内运行以下命令。如果您没有安装纱线,请改为运行这些命令。

     watchman watch-del-all
     rm -rf ./node_modules
     npm cache clean
     rm -rf $TMPDIR/react-*
     npm install
     npm cache clean
     npm install uuid
    
  5. 在Xcode中重建项目,并确保在运行应用程序之前进行任何建议的修改。

答案 3 :(得分:1)

这个答案有点晚了,但在我的情况下,这需要我重启我的iOS模拟器。我按照我的日志文件中显示的说明(来自react-native log-ios

    This might be related to https://github.com/facebook/react-native/issues/4968
        To resolve try the following:
          1. Clear watchman watches: `watchman watch-del-all`.
          2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
          3. Reset packager cache: `rm -fr $TMPDIR/react-*` or `npm start -- --reset-cache`.

希望这有帮助。

答案 4 :(得分:0)

在我继承的项目中,Git repo包含两个子目录./packages/state-manager/package.json - 并且有一个安装依赖项的顶级(小)yarn setup文件两者都在调用yarn命令时。在了解这一点之前,我一直试图在./packages/mobile文件夹中运行DateTime并获得可怕的红屏和错误。希望这会有所帮助。

答案 5 :(得分:0)

确保源文件不在名称为 redux 的文件夹中。 将文件夹重命名为其他名称后,错误消失了。