Fixon
Fixon
  • 发布:2024-03-28 11:43
  • 更新:2024-04-07 14:52
  • 阅读:376

【报Bug】uni-cli-shared Mac M1打包时报错 Cannot find module '@dcloudio/uts-darwin-x64'

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 14.4.1

手机系统: 全部

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: CLI

CLI版本号: 4.0.5

测试过的手机:

MUI14.0.4、IOS17

示例代码:
const path = require('path')  
const {  
  resolveUTSCompiler,  
  parseUniExtApiNamespacesOnce  
} = require('./uts')  
module.exports = function (content) {  
  const callback = this.async()  
  resolveUTSCompiler().compile(path.dirname(this.resourcePath), {  
    isX: false,  
    isPlugin: true,  
    extApis: parseUniExtApiNamespacesOnce(  
      process.env.UNI_UTS_PLATFORM,  
      process.env.UNI_UTS_TARGET_LANGUAGE  
    ),  
    sourceMap: process.env.NODE_ENV === 'development'  
  }).then(result => {  
    if (result) {  
      result.deps.forEach((dep) => {  
        this.addDependency(dep)  
      })  
      callback(null, result.code)  
    } else {  
      callback(null, '')  
    }  
  }).catch(err => {  
    callback(err)  
  })  
}

操作步骤:

在mac m1或者arm芯片的mac点击打包时报错
11:32:15.146 Module build failed (from ./node_modules/@dcloudio/uni-cli-shared/lib/uts/uts-loader.js):
11:32:15.147 Error: Cannot find module '@dcloudio/uts-darwin-x64'
11:32:15.152 Require stack:
11:32:15.156 - /node_modules/@dcloudio/uts/dist/binding.js
11:32:15.166 - /node_modules/@dcloudio/uts/dist/api.js
11:32:15.171 - /node_modules/@dcloudio/uts/dist/index.js
11:32:15.179 - /node_modules/@dcloudio/uni-uts-v1/dist/code.js
11:32:15.183 - /node_modules/@dcloudio/uni-uts-v1/dist/index.js
11:32:15.187 - /node_modules/@dcloudio/uni-cli-shared/lib/uts/uts.js
11:32:15.191 - /node_modules/@dcloudio/uni-cli-shared/lib/uts/resolver.js
11:32:15.195 - /node_modules/@dcloudio/uni-cli-shared/lib/uts/index.js
11:32:15.200 - /node_modules/@dcloudio/uni-cli-shared/lib/index.js
11:32:15.204 - /node_modules/@dcloudio/vue-cli-plugin-uni/lib/env.js
11:32:15.209 - /node_modules/@dcloudio/vue-cli-plugin-uni/index.js
11:32:15.214 - /node_modules/@vue/cli-service/lib/Service.js
11:32:15.218 - /node_modules/@vue/cli-service/bin/vue-cli-service.js
11:32:15.228 at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
11:32:15.233 at Function.Module._resolveFilename (/node_modules/module-alias/index.js:49:29)
11:32:15.239 at Function.Module._load (node:internal/modules/cjs/loader:804:27)
11:32:15.240 at Module.require (node:internal/modules/cjs/loader:1028:19)
11:32:15.251 at require (node:internal/modules/cjs/helpers:102:18)
11:32:15.256 at resolveNativeBinding (/node_modules/@dcloudio/uts/dist/binding.js:99:12)
11:32:15.266 at Object.<anonymous> (/node_modules/@dcloudio/uts/dist/binding.js:101:19)
11:32:15.271 at Module._compile (node:internal/modules/cjs/loader:1126:14)
11:32:15.275 at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
11:32:15.284 at Module.load (node:internal/modules/cjs/loader:1004:32)
11:32:15.289 at Function.Module._load (node:internal/modules/cjs/loader:839:12)
11:32:15.290 at Module.require (node:internal/modules/cjs/loader:1028:19)
11:32:15.293 at require (node:internal/modules/cjs/helpers:102:18)
11:32:15.297 at Object.<anonymous> (/node_modules/@dcloudio/uts/dist/api.js:9:7)
11:32:15.298 at Module._compile (node:internal/modules/cjs/loader:1126:14)
11:32:15.302 at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
11:32:15.305 at Module.load (node:internal/modules/cjs/loader:1004:32)
11:32:15.306 at Function.Module._load (node:internal/modules/cjs/loader:839:12)
11:32:15.315 at Module.require (node:internal/modules/cjs/loader:1028:19)
11:32:15.319 at require (node:internal/modules/cjs/helpers:102:18)
11:32:15.324 at Object.<anonymous> (/node_modules/@dcloudio/uts/dist/index.js:4:15)
11:32:15.327 at Module._compile (node:internal/modules/cjs/loader:1126:14)
11:32:15.330 at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
11:32:15.334 at Module.load (node:internal/modules/cjs/loader:1004:32)
11:32:15.334 at Function.Module._load (node:internal/modules/cjs/loader:839:12)
11:32:15.338 at Module.require (node:internal/modules/cjs/loader:1028:19)
11:32:15.343 at require (node:internal/modules/cjs/helpers:102:18)
11:32:15.347 at parseInterfaceTypes (/node_modules/@dcloudio/uni-uts-v1/dist/code.js:231:23)
11:32:15.348 at genProxyCode (/node_modules/@dcloudio/uni-uts-v1/dist/code.js:24:27)
11:32:15.352 at Object.compile (/node_modules/@dcloudio/uni-uts-v1/dist/index.js:107:48)
11:32:15.355 at Object.<anonymous> (/node_modules/@dcloudio/uni-cli-shared/lib/uts/uts-loader.js:8:24)

预期结果:

能够成功云打包

实际结果:

打包报错,无法云打包APK或IPA

bug描述:

云打包自定义基座及发布版本时报错
11:32:15.146 Module build failed (from ./node_modules/@dcloudio/uni-cli-shared/lib/uts/uts-loader.js):
11:32:15.147 Error: Cannot find module '@dcloudio/uts-darwin-x64'

package.json DcloudIO版本

{  
    "@dcloudio/types": "^3.3.2",  
    "@dcloudio/uni-automator": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/uni-cli-i18n": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/uni-cli-shared": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/uni-helper-json": "*",  
    "@dcloudio/uni-migration": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/uni-template-compiler": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/uni-uts-v1": "^3.0.0-alpha-3060920221117001",  
    "@dcloudio/vue-cli-plugin-hbuilderx": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/vue-cli-plugin-uni": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/vue-cli-plugin-uni-optimize": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/webpack-uni-mp-loader": "2.0.2-alpha-4000520240320001",  
    "@dcloudio/webpack-uni-pages-loader": "2.0.2-alpha-4000520240320001",  
    "@vue/cli-plugin-babel": "~5.0.0",  
    "@vue/cli-service": "~5.0.0",  
    "@vue/eslint-config-standard": "^8.0.1",  
}
2024-03-28 11:43 负责人:无 分享
已邀请:

要回复问题请先登录注册