React-native - 由于双重转换导致构建失败

React-native - Build failed due to double-conversion

我已经通过终端创建了新的 react-native 项目。

react-native init PlayWithAnimation  

当我通过 Xcode 运行 react-native 应用程序时。我收到了这个错误。

/bin/sh -c \"/Users/sumit/Desktop/React\ Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh\"

/Users/sumit/Desktop/React >Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 2: cd: /Users/sumit/Desktop/React: No such file or directory

/Users/sumit/Desktop/React >Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: /Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh: No such file or directory

/Users/sumit/Desktop/React Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh: line 3: exec: /Users/sumit/Desktop/React Native/RNN/node_modules/react-native/React/scripts/ios-install-third-party.sh: cannot execute: No such file or directory

The following build commands failed:

PhaseScriptExecution Install\ Third\ Party /Users/sumit/Desktop/React\ Native/RNN/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh

(1 failure)

这些是我用过的版本:

node v8.0.0
npm 5.0.3
react-native-cli: 2.0.1
react-native: 0.46.0
xcode 8.3.3

我已经查看了其他Whosebug问答的相关内容,但没有找到合适的解决方案。

临时解决方案:

如果我使用 version="0.44.0" 创建 react-native,它会顺利运行。但是在 version 0.45.0, 0.46.0, 0.47.0 中构建失败并且出现了相同的 "double-conversion" 问题。还有一件事,当我创建新项目时,第三方目录丢失了。

node_modules/react-native/ (missing third-party directory)

会是什么问题?

已尝试解决方案 1:

我做了以下步骤:

  1. 下载.sh里面需要的文件,放到~/.rncache/.

  2. 将下载的文件复制到node_modules/react-native/third-party/,运行tar-zxf ***到每个文件

  3. 再次构建。但没有奏效。

已尝试解决方案 2:

Handling third party build error on react-native 0.46x. 并尝试 github 问题。

我真的很兴奋终于开始使用 React Native,tar 但这个错误绝对扼杀了我继续进行的能力。如果有人能帮我解决这个问题,我将不胜感激。

Got the solution from jerry han here: 救命稻草

Hi Bala, As you can see the error log, That error was from ‘WhiteSpace’ on your working path.

Real Path : /Users/sumit/Desktop/React\ Native/
On cd cmd log : /Users/sumit/Desktop/React:
You should rename your working path to ‘/Users/sumit/Desktop/react_native’.

这对你有帮助。

对于开发或运维工作,路径上最好不要使用‘space’。

对我来说,有用的只是将 Xcode 中的代码签名首选项更新为不同的内容,然后再更新回来。

例如我最初打开了 Automatically manage signing。将其关闭并重新打开似乎可以解决此问题。