I received an error when I build the app on Xcode:
/bin/sh: yarn: command not found
make: *** [LocalMediaPicker/Sources/LocalMediaPicker/Generated/i18n.stamp] Error 127
Command PhaseScriptExecution failed with a nonzero exit code
But I run which yarn
in terminal get /opt/homebrew/bin/yarn
, not sure why the Xcode cannot find yarn
Xcode version: Version 13.4.1 (13F100)
yarn version: 1.22.17
OS: Monterey Version 12.3
Update: Tried npm i -g yarn
> [email protected] preinstall /opt/homebrew/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/yarn/bin/yarn.js
npm ERR! dest /opt/homebrew/bin/yarn
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/yarn/bin/yarn.js' -> '/opt/homebrew/bin/yarn'
npm ERR! File exists: /opt/homebrew/bin/yarn
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
CodePudding user response:
sudo npm install -g npm
then
sudo nom install -g yarn
Reboot your system this worked for me. There probably is a problem with mapping so that could be your problem.
CodePudding user response:
yarn
is installed in a location that isn't in the PATH
used by the build phase scripts. There's two ways I can think of to change the script so it should work.
Before calling yarn
, add the path containing the executable to the PATH
the script will use.
export PATH="$PATH:/opt/homebrew/bin"
yarn ...
Call yarn
using the full path to the executable instead of just the name.
/opt/homebrew/bin/yarn ...