云打包 或者 编译都会报错
- 发布:2023-07-27 18:27
- 更新:2023-08-24 12:16
- 阅读:450
产品分类: uniapp/App
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 13.2.1
HBuilderX类型: 正式
HBuilderX版本号: 3.8.7
手机系统: Android
手机系统版本号: Android 13
手机厂商: 华为
手机机型: oppo reno 7
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常打包
正常打包
实际结果:
打包报错
打包报错
bug描述:
#!/usr/bin/env node
// TODO 暂时处理安装目录包含特殊符号,导致 H5 预览资源加载失败的问题。
const matchSymbol = __dirname.match(/[()]/)
if (matchSymbol) {
console.error(`编译失败:HBuilderX 安装目录不能包括 ${matchSymbol[0]} 等特殊字符`)
process.exit(0)
}
const fs = require('fs')
const path = require('path')
const {
error
} = require('@vue/cli-shared-utils')
const yargsParser = require('yargs-parser')
const argv = yargsParser(process.argv.slice(2))
process.env.UNI_INPUT_DIR = path.resolve(process.env.UNI_INPUT_DIR)
process.env.UNI_OUTPUT_DIR = path.resolve(process.env.UNI_OUTPUT_DIR)
if (process.env.UNI_SCRIPT) {
const {
initCustomScript
} = require('@dcloudio/uni-cli-shared/lib/package')
initCustomScript(process.env.UNI_SCRIPT, path.resolve(process.env.UNI_INPUT_DIR, 'package.json'))
}
const Service = require('@vue/cli-service')
const vueConfigJsPath = path.resolve(process.env.UNI_INPUT_DIR, 'vue.config.js')
if (fs.existsSync(vueConfigJsPath)) {
process.env.VUE_CLI_SERVICE_CONFIG_PATH = vueConfigJsPath
}
// @vue/cli-service/lib/Service.js
const service = new Service(process.env.VUE_CLI_CONTEXT || process.cwd())
const args = {
watch: process.env.NODE_ENV === 'development',
minimize: process.env.UNI_MINIMIZE === 'true',
clean: false
}
if (argv['auto-port']) {
args['auto-port'] = argv['auto-port']
}
if (argv['auto-host']) {
args['auto-host'] = argv['auto-host']
}
const platform = process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM
service.run((process.env.NODE_ENV === 'development' && platform === 'h5') ? 'uni-serve' : 'uni-build',
args).catch(err => {
if (err.message.includes('@dcloudio/uni-mp-lark/dist/uni.mp.esm.js')) {
err = new Error('Vue3 项目暂不支持飞书小程序')
}
error(err)
process.exit(1)
})
文件没改过
报错信息
[HBuilder] 18:21:15.507 Module Error (from ./node_modules/@dcloudio/vue-cli-plugin-hbuilderx/packages/webpack-uni-nvue-loader/lib/style.js):
[HBuilder] 18:21:15.518 (Emitted value instead of an instance of Error) Error: undefined:103:12: property missing ':',Error: undefined:103:12: missing '}',Error: undefined:103:12: selector missing
[HBuilder] 18:21:15.526 项目 'smartApp' 编译成功。
[HBuilder] 18:21:15.531 TypeError: Cannot read properties of undefined (reading 'includes')
[HBuilder] 18:21:15.531 at /Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli/bin/uniapp-cli.js:53:21
[HBuilder] 18:21:15.550 at processTicksAndRejections (node:internal/process/task_queues:96:5)
[HBuilder] 18:21:15.555 Error: Client network socket disconnected before secure TLS connection was established
[HBuilder] 18:21:15.559 at connResetException (node:internal/errors:704:14)
[HBuilder] 18:21:15.559 at TLSSocket.onConnectEnd (node:_tls_wrap:1590:19)
[HBuilder] 18:21:15.563 at TLSSocket.emit (node:events:525:35)
[HBuilder] 18:21:15.566 at endReadableNT (node:internal/streams/readable:1358:12)
[HBuilder] 18:21:15.569 at processTicksAndRejections (node:internal/process/task_queues:83:21) {
[HBuilder] 18:21:15.569 code: 'ECONNRESET',
[HBuilder] 18:21:15.572 path: null,
[HBuilder] 18:21:15.576 host: '96f0e031-f37a-48ef-84c7-2023f6360c0a.bspapp.com',
[HBuilder] 18:21:15.579 port: 443,
[HBuilder] 18:21:15.579 localAddress: undefined
[HBuilder] 18:21:15.581 }
两只羊 (作者)
项目 不是文件
2023-07-27 20:06