node 版本:18.17.0
mac 电脑使用 npx degit dcloudio/uni-preset-vue#vite-ts vue3-vite-ts-uniapp 命令创建uniapp+vue3+ts项目
cd vue3-vite-ts-uniapp
npm install
hbuilder工具打开项目执行运行或者发行
- 发布:2024-11-07 15:02
- 更新:2024-12-04 17:51
- 阅读:44
npx degit dcloudio/uni-preset-vue#vite-ts vue3-vite-ts-uniapp 创建项目,mac电脑无法使用hbuilder运行或发行项目
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: MacBook Pro Apple M1 版本15.0.1 (24A348)
HBuilderX类型: 正式
HBuilderX版本号: 4.29
第三方开发者工具版本号: 1.06.2409140darwin-arm64
基础库版本号: 3.6.4
项目创建方式: HBuilderX
操作步骤:
预期结果:
期望可以在mac电脑上使用hbuilder正常的发行或者运行项目(H5 、小程序、App)
期望可以在mac电脑上使用hbuilder正常的发行或者运行项目(H5 、小程序、App)
实际结果:
控制台报错:
14:40:31.906 项目 'vue3-vite-ts-uniapp' 开始编译...
14:40:33.671 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布
14:40:33.681 正在编译中...
14:40:33.809 error during build:
14:40:33.813 Error: Cannot find module @rollup/rollup-darwin-x64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i
again after removing both package-lock.json and node_modules directory.
14:40:33.814 at requireWithFriendlyError (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:63:9)
14:40:33.822 at Object.<anonymous> (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:72:76)
14:40:33.824 at Module._compile (node:internal/modules/cjs/loader:1364:14)
14:40:33.828 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
14:40:33.833 at Module.load (node:internal/modules/cjs/loader:1203:32)
14:40:33.836 at Module._load (node:internal/modules/cjs/loader:1019:12)
14:40:33.838 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
14:40:33.843 at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
14:40:33.847 at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
14:40:33.849 at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
控制台报错:
14:40:31.906 项目 'vue3-vite-ts-uniapp' 开始编译...
14:40:33.671 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布
14:40:33.681 正在编译中...
14:40:33.809 error during build:
14:40:33.813 Error: Cannot find module @rollup/rollup-darwin-x64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i
again after removing both package-lock.json and node_modules directory.
14:40:33.814 at requireWithFriendlyError (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:63:9)
14:40:33.822 at Object.<anonymous> (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:72:76)
14:40:33.824 at Module._compile (node:internal/modules/cjs/loader:1364:14)
14:40:33.828 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
14:40:33.833 at Module.load (node:internal/modules/cjs/loader:1203:32)
14:40:33.836 at Module._load (node:internal/modules/cjs/loader:1019:12)
14:40:33.838 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
14:40:33.843 at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
14:40:33.847 at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
14:40:33.849 at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
bug描述:
使用:npx degit dcloudio/uni-preset-vue#vite-ts vue3-vite-ts-uniapp 这个方式创建uniapp+vue3+ts项目时,mac电脑无法使用hbuilder编辑器直接运行或者发行项目,小程序、H5、App报错都不可以,按照提示的方案也没有解决,但是windows电脑是可以正常的三端运行的,非常影响开发,公司同事的mac电脑我们测试了好几台都无法直接运行,必须使用命令行的模式去运行或者发行H5
主要报错如下:
14:40:33.809 error during build:
14:40:33.813 Error: Cannot find module @rollup/rollup-darwin-x64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try npm i
again after removing both package-lock.json and node_modules directory.
14:40:33.814 at requireWithFriendlyError (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:63:9)
14:40:33.822 at Object.<anonymous> (/Users/rose/rose的文件/study-demos/vue3-vite-ts-uniapp/node_modules/rollup/dist/native.js:72:76)
14:40:33.824 at Module._compile (node:internal/modules/cjs/loader:1364:14)
14:40:33.828 at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
14:40:33.833 at Module.load (node:internal/modules/cjs/loader:1203:32)
14:40:33.836 at Module._load (node:internal/modules/cjs/loader:1019:12)
14:40:33.838 at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
14:40:33.843 at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
14:40:33.847 at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
14:40:33.849 at async importModuleDynamicallyWrapper (node:internal/vm/module:432:15)
DCloud_UNI_yuhe
运行一下 pnpm i @rollup/rollup-darwin-x64 --force
2024-12-04 19:15