flutter Error (Xcode): Undefined symbol: node::DefineJavaScriptHash(node::Environment*, v8::Local<v8

flutter 编译ios XCode报错如下:

Error (Xcode): Undefined symbol: node::DefineJavaScriptHash(node::Environment*, v8::Local<v8::Object>)
Error (Xcode): Undefined symbol: node::NodePerContextSource(v8::Isolate*)
Error (Xcode): Undefined symbol: node::DefineJavaScript(node::Environment*, v8::Local<v8::Object>)
Error (Xcode): Undefined symbol: node::LoadersBootstrapperSource(node::Environment*)
Error (Xcode): Undefined symbol: node::NodeBootstrapperSource(node::Environment*)
Encountered error while building for device.
这个问题的根本原因是 LiquidCore 这个库内部有需要python下载的东西,你本地如果存在python2和python3的环境,那么可能会产生下载冲突的问题,详情可以参看官方的problem list:
https://github.com/LiquidPlayer/LiquidCore/issues/230 https://github.com/LiquidPlayer/LiquidCore/issues/160
‘setting path for python 2.7 to .bash_profile‘ 修改你的.bash_profile文件,下载完python2.7.18之后把下面代码放到环境变量文件中。
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
alias python="/Library/Frameworks/Python.framework/Versions/2.7/bin/python"

在M1芯片上略有差异:
同步下昨天说的那个无法build成功的问题,在M1电脑芯片上也会有同样的问题出现。具体的解决办法跟inter芯片有一些差异。
**【非常重要】1.需要提前下载python2.7.18 !!这一点非常重要,然后确定python2.7.18可以正常在你的环境上运行起来

flutter 删掉你工程下的 pubspec.lock
删掉你的ios目录下的Podfile.lock
fluuter clean

pod cache clean 'LiquidCore'
pod cache clean 'LiquidCore' --all
确保你的网可以!!!!!
pod install

你可能感兴趣的:(flutter,xcode,macos)