From 0d82b402aa546aa773e91921989fb8389aee81dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umut=20Topuzo=C4=9Flu?= Date: Tue, 14 Feb 2023 07:05:03 -0800 Subject: [PATCH] Fix missing node error message not printed correctly (#36140) Summary: When the node version could not be found there is an error message shown to help what can be done to fix this issue (for example in the error logs in xcode) The problem was that the backtick symbol is interpreted as running commands in terminals so the parts that were in backticks were run and the error message was printed incompletely. Also there were other errors added (.xcode.env command not found, for example) which makes it harder to understand what is going on. In bash / zsh single quotes does not expand commands and variables unlike double quotes which does this. ## Changelog [IOS] [FIXED] - Fix missing node error message not printed correctly when deprecated `find-node-for-xcode.sh` is used. Pull Request resolved: https://github.com/facebook/react-native/pull/36140 Test Plan: I just ran the xcode build again after updating it manually in the node_modules folder. The log output changed from this ``` [Warning] You need to configure your node path in the environment. You can set it up quickly by running: echo 'export NODE_BINARY=/Users/uloco/Library/Caches/fnm_multishells/78434_1676301546457/bin/node' > .xcode.env in the ios folder. This is needed by React Native to work correctly. We fallback to the DEPRECATED behavior of finding . This will be REMOVED in a future version. You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment ``` to this ``` [Warning] You need to configure your node path in the `".xcode.env" file` environment. You can set it up quickly by running: `echo export NODE_BINARY=$(command -v node) > .xcode.env` in the ios folder. This is needed by React Native to work correctly. We fallback to the DEPRECATED behavior of finding `node`. This will be REMOVED in a future version. You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment ``` Reviewed By: cortinico, cipolleschi Differential Revision: D43258623 Pulled By: rshest fbshipit-source-id: 7db0d983b204e59504666686be78311c4c2fb993 --- scripts/xcode/with-environment.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/xcode/with-environment.sh b/scripts/xcode/with-environment.sh index e4a8e42436e7bf..f36190e6b146db 100755 --- a/scripts/xcode/with-environment.sh +++ b/scripts/xcode/with-environment.sh @@ -32,12 +32,12 @@ fi if [ -n "$NODE_BINARY" ]; then echo "Node found at: ${NODE_BINARY}" else - echo "[Warning] You need to configure your node path in the `'.xcode.env' file` environment. " \ - "You can set it up quickly by running: " \ - "echo 'export NODE_BINARY=$(command -v node)' > .xcode.env " \ - "in the ios folder. This is needed by React Native to work correctly. " \ - "We fallback to the DEPRECATED behavior of finding `node`. This will be REMOVED in a future version. " \ - "You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment" >&2 + echo '[Warning] You need to configure your node path in the `".xcode.env" file` environment. ' \ + 'You can set it up quickly by running: ' \ + '`echo export NODE_BINARY=$(command -v node) > .xcode.env` ' \ + 'in the ios folder. This is needed by React Native to work correctly. ' \ + 'We fallback to the DEPRECATED behavior of finding `node`. This will be REMOVED in a future version. ' \ + 'You can read more about this here: https://reactnative.dev/docs/environment-setup#optional-configuring-your-environment' >&2 source "${REACT_NATIVE_PATH}/scripts/find-node-for-xcode.sh" fi