Specifically the "Geshuild/darwin-arm64" package is present but this platform...

55 阅读1分钟

uniapp报@esbuild相关错误

uniapp.jpeg

错误信息

This won't work because esbuild is written with native code and needs to install a platform-specific binary executable. Specifically the "Geshuild/darwin-arm64" package is present but this platform needs the "@esbuild/darwin-×64" package instead.

9F3812E9-F855-41DC-946A-13EE0D9E9F04.png

一 项目基础环境简介

1,uniapp初始化环境:vue3vite@5.2.8

2,Node 18.18.2

二 解决方案

解决方案总共有三步

2.1 修改vite版本,以我的项目为例,修改为 v4.4.0

image.png

2.2 删除node_modules,重新安装包


yarn | npm install 

2.3 找到node_modules下面的@esbuild包, copy 一下@esbuild下面的darwin-arm64,复制到当前的@esbuild目录下面,重新命名为darwin-×64即可

image.png

至此就解决了,当然环境问题不可能都一样,这里只是提供当前我这里的环境和项目报出的错误,大家如果有一样的问题可以按照这个思路解决试试。