uni-app昨天运行到浏览器都没有问题今天运行不了
昨天运行到浏览器都没有问题今天运行不了
开发环境 | 版本号 | 项目创建方式 |
---|---|---|
Windows | 1 | HBuilderX |
产品分类:
uniapp/H5
PC开发环境操作系统:
Windows
HBuilderX类型:
正式
HBuilderX版本号:
3.7.9
浏览器平台:
Chrome
浏览器版本:
118.0.5993.89
示例代码:
10:07:41.513 error when starting dev server: 10:07:41.522 Error: 10:07:41.530 You installed esbuild for another platform than the one you’re currently using. 10:07:41.537 This won’t work because esbuild is written with native code and needs to 10:07:41.546 install a platform-specific binary executable. 10:07:41.554 Specifically the “@esbuild/win32-ia32” package is present but this platform 10:07:41.562 needs the “@esbuild/win32-ia32” package instead. People often get into this 10:07:41.570 situation by installing esbuild on Windows or macOS and copying “node_modules” 10:07:41.570 into a Docker image that runs Linux, or by copying “node_modules” between 10:07:41.578 Windows and WSL environments. 10:07:41.586 If you are installing with npm, you can try not copying the “node_modules” 10:07:41.595 directory when you copy the files over, and running “npm ci” or “npm install” 10:07:41.595 on the destination platform after the copy. Or you could consider using yarn 10:07:41.603 instead of npm which has built-in support for installing a package on multiple 10:07:41.603 platforms simultaneously. 10:07:41.612 If you are installing with yarn, you can try listing both this platform and the 10:07:41.621 other platform in your “.yarnrc.yml” file using the “supportedArchitectures” 10:07:41.621 feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures 10:07:41.628 Keep in mind that this means multiple copies of esbuild will be present. 10:07:41.629 Another alternative is to use the “esbuild-wasm” package instead, which works 10:07:41.636 the same way on all platforms. But it comes with a heavy performance cost and 10:07:41.636 can sometimes be 10x slower than the “esbuild” package, so you may also not 10:07:41.645 want to do that. 10:07:41.646 at generateBinPath (F:\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1841:17) 10:07:41.653 at esbuildCommandAndArgs (F:\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1922:33) 10:07:41.654 at ensureServiceIsRunning (F:\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2087:25) 10:07:41.662 at build (F:\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1978:26) 10:07:41.670 at bundleConfigFile (file:///F:/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62245:26) 10:07:41.679 at loadConfigFromFile (file:///F:/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62221:31) 10:07:41.687 at resolveConfig (file:///F:/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61843:34) 10:07:41.695 at Module.createServer (file:///F:/HBuilderX/plugins/uniapp-cli-vite/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61153:26) 10:07:41.703 at F:\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\index.cjs:23:55 10:07:41.712 at async createServer (F:\HBuilderX\plugins\uniapp-cli-vite\node_modules@dcloudio\vite-plugin-uni\dist\cli\server.js:44:20)
操作步骤:
1
预期结果:
1
实际结果:
1
更多关于uni-app昨天运行到浏览器都没有问题今天运行不了的实战教程也可以访问 https://www.itying.com/category-93-b0.html
和这个问题相似,可以参考解决 https://ask.dcloud.net.cn/question/145281
更多关于uni-app昨天运行到浏览器都没有问题今天运行不了的实战教程也可以访问 https://www.itying.com/category-93-b0.html
从错误信息来看,这是esbuild平台兼容性问题导致的。建议按以下步骤解决:
-
删除项目下的node_modules文件夹和package-lock.json/yarn.lock文件
-
清除HBuilderX缓存:
- 关闭HBuilderX
- 删除HBuilderX安装目录下的plugins/uniapp-cli-vite/node_modules文件夹
- 重新打开HBuilderX
- 重新安装依赖:
- 在项目根目录运行命令:
npm install
或
yarn install