XCode Cloud导出路径等环境变量丢失?

问题描述 投票:0回答:1

我有一个 ReactNative 项目,突然无法在 Xcode Cloud 中构建,因为找不到 Node。 这是作为构建的

Run command: 'xcodebuild archive ...'
部分的一部分发生的。 作为早期 ci_pre_xcodebuild.sh 脚本的一部分,节点安装成功完成,并由
yarn
pod install
成功使用。

但是好像有个Pod Xcode构建文件其实有一个想要再次使用Node的自定义脚本,而此时并没有找到。 xcodebuild 启动的脚本似乎找不到 ci_pre_xcodebuild.sh 脚本中设置的环境变量。

是否可以修复此问题以使它们可见?

=== BUILD AGGREGATE TARGET FBReactNativeSpec OF PROJECT Pods WITH CONFIGURATION Release ===
WriteAuxiliaryFile /Volumes/workspace/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Commutyble/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-C002E9D3BBBD3F63C0DD29E56E81D563.sh (in target 'FBReactNativeSpec' from project 'Pods')
    cd /Volumes/workspace/repository/ios/Pods
    write-file /Volumes/workspace/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Commutyble/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-C002E9D3BBBD3F63C0DD29E56E81D563.sh

PhaseScriptExecution [CP-User]\ Generate\ Specs /Volumes/workspace/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Commutyble/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-C002E9D3BBBD3F63C0DD29E56E81D563.sh (in target 'FBReactNativeSpec' from project 'Pods')
    cd /Volumes/workspace/repository/ios/Pods
    /bin/sh -c /Volumes/workspace/DerivedData/Build/Intermediates.noindex/ArchiveIntermediates/Commutyble/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/FBReactNativeSpec.build/Script-C002E9D3BBBD3F63C0DD29E56E81D563.sh

error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable.

Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable.

本地构建没问题。 我正在运行旧的 ReactNative 0.68 和 Xcode 14.3.1。 下面是安装 Node 并回显其路径的脚本,如构建日志输出所示:

NODE_PATH is /Volumes/workspace/repository/ios/ci_scripts/node-v16.20.2-darwin-x64/bin

PATH is :/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/bin:/Users/local/Homebrew:/Users/local/Homebrew/bin:/usr/local/bin:/Users/local/Homebrew:/Users/local/Homebrew/bin:/Volumes/workspace/repository/ios/ci_scripts/node-v16.20.2-darwin-x64/bin

/Volumes/workspace/repository/ios/ci_scripts/node-v16.20.2-darwin-x64/bin/node

NODE_BINARY is /Volumes/workspace/repository/ios/ci_scripts/node-v16.20.2-darwin-x64/bin/node

v16.20.2

8.19.4

ci_pre_xcodebuild.sh

#!/bin/sh

export HOMEBREW_NO_INSTALL_CLEANUP=TRUE
brew install cocoapods

# have to add node yourself
NODE_VER=16
VERSION=$(curl -s https://nodejs.org/dist/latest-v$NODE_VER.x/ | sed -nE 's|.*>node-(.*)\.pkg</a>.*|\1|p')
if [[ "$(arch)" == "arm64" ]]
then
  ARCH="arm64"
else
  ARCH="x64"
fi

curl "https://nodejs.org/dist/latest-v$NODE_VER.x/node-$VERSION-darwin-$ARCH.tar.gz" -o $HOME/Downloads/node.tar.gz
tar -xf "$HOME/Downloads/node.tar.gz"
NODE_PATH="$PWD/node-$VERSION-darwin-$ARCH/bin"
PATH+=":$NODE_PATH"
export PATH
echo "NODE_PATH is $NODE_PATH"
echo "PATH is $PATH"
export NODE_BINARY=`which node`
which node
echo "NODE_BINARY is $NODE_BINARY"

node -v
npm -v

brew install yarn

# Install dependencies you manage with CocoaPods.
yarn
pod install
react-native xcode-cloud
1个回答
0
投票

你找到解决办法了吗?请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.