Canvas 作为著名的开源学习系统,云集了众多开发者为其贡献代码和设计思路,当然也少不了智能手机 App,包括 iOS 和 Android 两个平台。
下面我们详细了解下编译 iOS 版本的过程和可能遇到的问题。
问题一:node 路径问题
Can't find the 'node' binary to build the React Native bundle. If you have a non-standard Node.js installation, select your project in Xcode, find 'Build Phases' - 'Bundle React Native code and images' and change NODE_BINARY to an absolute path to your node executable. You can find it by invoking 'which node' in the terminal.

通过查看错误日志,不难发现是关于node 路径报错,具体解决方法如下:

打开 Terminal 工具,输入 which node 查看 node 程序所在路径,如下图:

得到 node 路径后,再次回到 Xcode,打开 Build Phases 面板,找到 Bundle React Native Code And Images,将原本的 NODE_BINARY 路径修改为 /opt/homebrew/opt/node@16/bin/node,如下图:

最后,再次编译 App。
问题二:Xcode unable to install