744934982
744934982
  • 发布:2022-01-14 13:20
  • 更新:2022-01-19 18:24
  • 阅读:1418

mac M1Pro 使用hbuilderx 启动微信小程序报错

分类:HBuilderX

mac M1Pro 使用hbuilderx 启动微信小程序,编译报错

Module build failed (from ./node_modules/_mini-css-extract-plugin@0.9.0@mini-css-extract-plugin/dist/loader.js):
13:10:23.014 ModuleError: Module Error (from ./node_modules/_sass-loader@10.2.0@sass-loader/dist/cjs.js):
13:10:23.019 Missing binding /Users/duqian/WebstormProjects/uniapp-approve-admin/node_modules/_node-sass@5.0.0@node-sass/vendor/darwin-x64-72/binding.node
13:10:23.019 Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x
13:10:23.024 Found bindings for the following environments:
13:10:23.024 - OS X Unsupported architecture (arm64) with Node.js 15.x
13:10:23.039 This usually happens because your environment has changed since running npm install.
13:10:23.039 Run npm rebuild node-sass to download the binding for your current environment.
13:10:23.045 at Object.emitError (/Users/duqian/WebstormProjects/uniapp-approve-admin/node_modules/_webpack@4.46.0@webpack/lib/NormalModule.js:173:6)
13:10:23.049 at getSassImplementation (/Users/duqian/WebstormProjects/uniapp-approve-admin/node_modules/_sass-loader@10.2.0@sass-loader/dist/utils.js:59:21)
13:10:23.050 at Object.loader (/Users/duqian/WebstormProjects/uniapp-approve-admin/node_modules/_sass-loader@10.2.0@sass-loader/dist/index.js:35:59)
13:10:23.055 ERROR Build failed with errors.

但是我其他项目能正常启动

2022-01-14 13:20 负责人:无 分享
已邀请:
DCloud_HB_WDL

DCloud_HB_WDL

提示已经很明确了, Node sass的问题。

  • Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 12.x
  • OS X Unsupported architecture (arm64) with Node.js 15.x

原因:

  1. HBuilderX内置的Node是v12.22.1
  2. 在HBuilderX内运行项目使用的是HBuilderX自带的Node。路径:/Applications/HBuilderX.app/Contents/HBuilderX/plugins/node

解决方法

使用Node 12版本,重新安装你项目下的依赖库。

  • 744934982 (作者)

    怎么修改成调用本地的node而不是内置。我其他项目的node只能用15版本才能解决node-sass报错问题

    2022-01-18 09:27

  • 744934982 (作者)

    回复 DCloud_HB_WDL: 我运行终端类型改成了外部终端,配置了node路径 但是,没有用啊

    2022-01-18 18:07

  • 744934982 (作者)

    回复 DCloud_HB_WDL: /Users/用户名/.nvm/versions/node/v15.14.0/bin/node

    2022-01-18 18:08

  • DCloud_HB_WDL

    回复 744934982: 看图标红部分。

    2022-01-18 18:27

  • 744934982 (作者)

    回复 DCloud_HB_WDL: 哪还有其他解决方案吗,我总不能一直来回更改node版本吧,调用小程序开发者工具能不能通过外部命令行来

    2022-01-19 16:27

  • DCloud_HB_WDL

    回复 744934982: 加下HBuilderX官方qq群: 793046085, 进群at管理

    2022-01-19 18:38

744934982

744934982 (作者)

怎么修改成调用本地的node而不是内置。我其他项目的node只能用15版本才能解决node-sass报错问题,

  • DCloud_HB_WDL

    HBuilderX 设置 运行设置,可以配置Node路径。刚跟相关人员确认过了,uni-app编译是生效的。

    2022-01-19 18:54

该问题目前已经被锁定, 无法添加新回复