app icon indicating copy to clipboard operation
app copied to clipboard

mac环境运行程序报错如何解决?

Open seho-dev opened this issue 4 years ago • 2 comments

image

seho-dev avatar Jun 06 '21 04:06 seho-dev

请注意运行模式下,因日志输出、sourcemap以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用cli发布命令进行发布
21:57:27.282 小程序各家浏览器内核及自定义组件实现机制存在差异,可能存在样式布局兼容问题,参考:https://uniapp.dcloud.io/matter?id=mp
21:57:27.282 正在编译中...
21:57:28.448 ERROR SyntaxError: Unexpected token {
21:57:28.456 /Users/jjw/Documents/banks/InternetQuestionBank/node_modules/fork-ts-checker-webpack-plugin-v5/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
21:57:28.456 } catch {
21:57:28.463 ^
21:57:28.463 SyntaxError: Unexpected token {
21:57:28.470 at createScript (vm.js:80:10)
21:57:28.473 at Object.runInThisContext (vm.js:139:10)
21:57:28.478 at Module._compile (module.js:616:28)
21:57:28.479 at Object.Module._extensions..js (module.js:663:10)
21:57:28.483 at Module.load (module.js:565:32)
21:57:28.488 at tryModuleLoad (module.js:505:12)
21:57:28.488 at Function.Module._load (module.js:497:3)
21:57:28.492 at Module.require (module.js:596:17)
21:57:28.496 at require (internal/module.js:11:18)
21:57:28.500 at Object. (/Users/jjw/Documents/banks/InternetQuestionBank/node_modules/fork-ts-checker-webpack-plugin-v5/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
21:57:28.500 at Module._compile (module.js:652:30)
21:57:28.506 at Object.Module._extensions..js (module.js:663:10)
21:57:28.510 at Module.load (module.js:565:32)
21:57:28.514 at tryModuleLoad (module.js:505:12)
21:57:28.514 at Function.Module._load (module.js:497:3)
21:57:28.518 at Module.require (module.js:596:17)

seho-dev avatar Jun 06 '21 04:06 seho-dev

解决方案在这里:https://ask.dcloud.net.cn/question/120549?notification_id-920812__rf-false__item_id-163835__answer_id-163835__single-TRUE#!answer_163835

只需要把运行程序的hbx的node环境更改为12+就可以了,hbx有一个内置的node版本太低导致一个依赖包编译失败。

seho-dev avatar Jun 06 '21 04:06 seho-dev