vite项目在jenkins自动打包报错:failed to load config from ../vite.config.js You installed esbuild on

vite项目在jenkins自动打包报错找不到esbuild-linux-64

在window环境开发用的找不到esbuild-windows-64,在linux环境构建需要使用esbuild-linux-64,找不到esbuild-linux-64就会报错

实际报错:

error during build:
11:21:11 Error: 
11:21:11 You installed esbuild on another platform than the one you're currently using.
11:21:11 This won't work because esbuild is written with native code and needs to
11:21:11 install a platform-specific binary executable.
11:21:11 
11:21:11 Specifically the "esbuild-windows-64" package is present but this platform
11:21:11 needs the "esbuild-linux-64" package instead. People often get into this
11:21:11 situation by installing esbuild on Windows or macOS and copying "node_modules"
11:21:11 into a Docker image that runs Linux, or by copying "node_modules" between
11:21:11 Windows and WSL environments.

报错原因: vite在linux环境打找不到esbuild-linux-64

2种解决方案:
1、在linux环境下,打包前先 npm i esbuild-linux-64

2、在外网windows环境下运行以下命令(可在版本号去package-lock.json中查看esbuild-linux-64版本号后自行修改下载)
curl -O https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.14.34.tgz
下载后解压得到package文件夹,将其改名为esbuild-linux-64复制到当前项目node_modules目录下即可

  • 8
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值