我已经通过终端创建了新的 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
我已经检查了与其他 stackoverflow 问答相关的内容,但没有得到适当的解决方案。
临时解决方案:
如果我使用 version="0.44.0"
创建 react-native,它会顺利运行。但是在版本 0.45.0、0.46.0、0.47.0
中,构建失败并且出现了同样的“双重转换” 问题。还有一件事,当我创建新项目时,第三方目录丢失了。
node_modules/react-native/ (missing third-party directory)
会是什么问题?
尝试过的解决方案 1:
我做了以下步骤:
下载.sh里面需要的文件,放到~/.rcache/中。
将下载的文件复制到 node_modules/react-native/third-party/,对每个文件运行 tar -zxf ***。
再次构建。但没有奏效。
尝试过的解决方案 2:
Handling third party build error on react-native 0.46x. 并尝试使用 github问题。
我真的很高兴终于开始使用 React Native,但这个错误绝对扼杀了我继续前进的能力。如果有人能帮我解决这个问题,我将不胜感激。
最佳答案
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’.
这对你有帮助。
对于开发或运维工作,您最好不要在路径上使用“空格”。
关于ios - React-native - 由于双重转换导致构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45252182/