Truffle 无法在 Mac M1 上安装

发布于 2025-01-10 19:00:57 字数 1047 浏览 0 评论 0原文

我正在尝试在我的 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.

我在网上找不到太多相关信息。

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

I am trying to install Truffle on my mac M1.

I started by following the instructions on the truffle web site in the Pet Shop tutorial I got node installed node successfully, but then I get this error...

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)).

I did a bit of research and was pointed at trying it in homebrew instead. I had to update homebrew first because of my M1 chip, which I did successfully. But I still get what appears to be the same or similar error...

/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.

I can't find out much about this online.

Does this mean that truffle only runs on intel chips and I need to use something like rosetta?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水染的天色ゝ 2025-01-17 19:00:57

好的,所以我终于弄清楚了这一点,并想我将在这里发布给后代。

问题是我在 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

并成功完成(尽管有一堆审核警告)

OK, so I finally figured this out and thought I would post here for posterity.

The issue was the version of the xcode command line tools that I had installed on my M1 Mac. I have no idea how, but it was an out of date version. The fix was to remove the command line tools and reinstall them. I think (I cannot say for certain) that this replaced them with M1/Arm versions and then the compile tools needed were in place.

To update I followed the steps in this Apple Developer Forum post
https://developer.apple.com/forums/thread/694283

Basically...

junk the existing folder

sudo rm -rf /Library/Developer/CommandLineTools

re-install

sudo Xcode-select --install 

After doing this I re-ran

sudo npm install -g truffle

and it completed successfully (albeit with a bunch of audit warnings)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文