Truffle无法在Mac M1上安装



我正在尝试在我的mac M1上安装Truffle。

我开始按照宠物店教程中松露网站上的说明,我成功地安装了节点,但后来我出现了这个错误。。。

sudo npm install -g truffle
...
npm ERR! xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).

我做了一些研究,有人建议我在自制软件中尝试一下。我必须首先更新自制软件,因为我的M1芯片,我成功地做到了。但我仍然得到了看起来相同或相似的错误。。。

/opt/homebrew/bin/brew install truffle
...
xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/libxcrun.dylib' (no such file)).
truffle: The x86_64 architecture is required for this software.

我在网上找不到太多关于这个的信息。

这是否意味着松露只在英特尔芯片上运行,我需要使用像罗塞塔这样的东西?

好吧,所以我终于明白了这一点,并认为我会在这里为子孙后代发布。

问题是我在M1 Mac上安装的xcode命令行工具的版本。我不知道怎么做,但这是一个过时的版本。修复方法是删除命令行工具并重新安装它们。我认为(我不能肯定(这用M1/Arm版本取代了它们,然后所需的编译工具就到位了。

为了更新,我遵循了苹果开发者论坛帖子中的步骤https://developer.apple.com/forums/thread/694283

基本上。。。

垃圾邮件现有文件夹

sudo rm -rf /Library/Developer/CommandLineTools

重新安装

sudo Xcode-select --install 

完成此操作后,我重新运行

sudo npm install -g truffle

它成功地完成了(尽管有一堆审计警告(

最新更新