uni-app app-view.js from Terser Error: error:0308010C:digital envelope routines::unsupported

uni-app app-view.js from Terser Error: error:0308010C:digital envelope routines::unsupported

测试过的手机:

操作步骤:

  • 将Hbuildx更新到最新版本

预期结果:

  • 原生App-制作应用wgt包可以正常运行

实际结果:

  • 控制台报错,打包不成功。

bug描述:

将HbuildX更新到4.15后运行制作热更包后报错,node版本为20.13.1,npm版本为10.5.2。 如果将Hbuildx还原到4.08则是正常打包

Image Image

信息类别 详细信息
产品分类 uniapp/App
PC开发环境 Mac
PC操作系统 macOS Sonoma 版本14.4.1 (23E224)
HBuilderX 正式
HBuilderX版本 4.15
手机系统 全部
手机厂商 苹果
页面类型 vue
vue版本 vue2
打包方式 离线
项目创建方式 HBuilderX

更多关于uni-app app-view.js from Terser Error: error:0308010C:digital envelope routines::unsupported的实战教程也可以访问 https://www.itying.com/category-93-b0.html

4 回复

控制台完整的信息报错如下

16:49:07.593
[广告] 16:49:07.604 uni-cdn,帮你节省至少30%的 CDN 费用!详情
[HBuilder] 16:49:07.613 项目 'st-uniapp-master’开始导出…
[HBuilder] 16:49:07.627 项目 ‘st-uniapp-master’ 开始编译…
[HBuilder] 16:49:08.910 4.08
[HBuilder] 16:49:08.983 正在编译中…
[HBuilder] 16:49:10.119 已忽略静态资源目录:static/h5、static/mp-weixin。详见:https://uniapp.dcloud.net.cn/tutorial/platform.html#static
[HBuilder] 16:49:10.239 uni-app 有新版本发布,请执行 npx @dcloudio/uvm@latest 更新,更新日志详见:https://download1.dcloud.net.cn/hbuilderx/changelog/4.15.2024050802.html
[HBuilder] 16:50:31.155 app-view.js from Terser
[HBuilder] 16:50:31.158 Error: error:0308010C:digital envelope routines::unsupported
[HBuilder] 16:50:31.159 at new Hash (node:internal/crypto/hash:69:19)
[HBuilder] 16:50:31.162 at Object.createHash (node:crypto:133:10)
[HBuilder] 16:50:31.164 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:217:37
[HBuilder] 16:50:31.167 at Array.forEach (<anonymous>)
[HBuilder] 16:50:31.169 at TerserPlugin.optimizeFn (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:160:259)
[HBuilder] 16:50:31.172 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
[HBuilder] 16:50:31.175 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.176 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1409:36
[HBuilder] 16:50:31.179 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.180 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.183 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1405:32
[HBuilder] 16:50:31.186 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.187 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.190 at Compilation.seal (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1342:27)
[HBuilder] 16:50:31.193 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:675:18
[HBuilder] 16:50:31.198 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1261:4
[HBuilder] 16:50:31.201 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
[HBuilder] 16:50:31.205 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.209 at Compilation.finish (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1253:28)
[HBuilder] 16:50:31.210 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:672:17
[HBuilder] 16:50:31.214 at eval (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
[HBuilder] 16:50:31.215 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/DynamicEntryPlugin.js:74:20
[HBuilder] 16:50:31.219 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[HBuilder] 16:50:31.222 项目 ‘st-uniapp-master’ 编译成功。
[HBuilder] 16:50:31.223 app-config.js from Terser
[HBuilder] 16:50:31.227 Error: error:0308010C:digital envelope routines::unsupported
[HBuilder] 16:50:31.228 at new Hash (node:internal/crypto/hash:69:19)
[HBuilder] 16:50:31.231 at Object.createHash (node:crypto:133:10)
[HBuilder] 16:50:31.232 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:217:37
[HBuilder] 16:50:31.236 at Array.forEach (<anonymous>)
[HBuilder] 16:50:31.240 at TerserPlugin.optimizeFn (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:160:259)
[HBuilder] 16:50:31.240 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
[HBuilder] 16:50:31.244 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.247 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1409:36
[HBuilder] 16:50:31.248 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.252 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.256 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1405:32
[HBuilder] 16:50:31.256 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.260 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.264 at Compilation.seal (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1342:27)
[HBuilder] 16:50:31.264 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:675:18
[HBuilder] 16:50:31.271 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1261:4
[HBuilder] 16:50:31.271 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
[HBuilder] 16:50:31.275 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.278 at Compilation.finish (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1253:28)
[HBuilder] 16:50:31.278 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:672:17
[HBuilder] 16:50:31.282 at eval (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
[HBuilder] 16:50:31.285 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/DynamicEntryPlugin.js:74:20
[HBuilder] 16:50:31.288 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[HBuilder] 16:50:31.291 app-service.js from Terser
[HBuilder] 16:50:31.294 Error: error:0308010C:digital envelope routines::unsupported
[HBuilder] 16:50:31.297 at new Hash (node:internal/crypto/hash:69:19)
[HBuilder] 16:50:31.301 at Object.createHash (node:crypto:133:10)
[HBuilder] 16:50:31.301 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:217:37
[HBuilder] 16:50:31.305 at Array.forEach (<anonymous>)
[HBuilder] 16:50:31.308 at TerserPlugin.optimizeFn (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:160:259)
[HBuilder] 16:50:31.309 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
[HBuilder] 16:50:31.312 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.315 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1409:36
[HBuilder] 16:50:31.318 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.319 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.322 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1405:32
[HBuilder] 16:50:31.325 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
[HBuilder] 16:50:31.326 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.329 at Compilation.seal (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1342:27)
[HBuilder] 16:50:31.329 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:675:18
[HBuilder] 16:50:31.332 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1261:4
[HBuilder] 16:50:31.335 at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
[HBuilder] 16:50:31.336 at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
[HBuilder] 16:50:31.339 at Compilation.finish (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1253:28)
[HBuilder] 16:50:31.342 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:672:17
[HBuilder] 16:50:31.343 at eval (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
[HBuilder] 16:50:31.346 at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/DynamicEntryPlugin.js:74:20
[HBuilder] 16:50:31.349 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[HBuilder] 16:50:31.352 ERROR Build failed with errors.
[HBuilder] 16:50:31.355 项目 'st-uniapp-master’导出失败

更多关于uni-app app-view.js from Terser Error: error:0308010C:digital envelope routines::unsupported的实战教程也可以访问 https://www.itying.com/category-93-b0.html


node版本使用20.13.1使用运行npm run build 和 npm run build:mp-weixin会报错。 packageUser/pages/user/setup/mobileUnbind/mobileUnbind.js from Terser
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:79:19)
at Object.createHash (node:crypto:139:10)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:217:37
at Array.forEach (<anonymous>)
at TerserPlugin.optimizeFn (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/terser-webpack-plugin/dist/index.js:160:259)
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1409:36
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1405:32
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
at Compilation.seal (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1342:27)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:675:18
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1261:4
at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:24:1)
at AsyncSeriesHook.lazyCompileHook (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/Hook.js:154:20)
at Compilation.finish (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compilation.js:1253:28)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/Compiler.js:672:17
at eval (eval at create (/Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
at /Users/jackliy/Desktop/美亚/demo/git/st-uniapp-master/node_modules/webpack/lib/DynamicEntryPlugin.js:74:20
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

error
… 切换node版本到16.18.1,运行npm run build 和 npm run build:mp-weixin则不会报错,但同样在hbuildx版本为4.15制作热更包报错

uni-app 有新版本发布,请执行 npx @dcloudio/uvm@latest 更新 需要更新版本

The error error:0308010C:digital envelope routines::unsupported typically occurs when you’re using a version of Node.js that has deprecated certain cryptographic algorithms or configurations. This issue often arises when using Node.js v17 or later, which has stricter security settings by default.

Steps to Resolve the Issue:

1. Downgrade Node.js Version

  • If you’re using Node.js v17 or later, consider downgrading to Node.js v16, which is a long-term support (LTS) version and is more stable for many projects.
  • You can use a Node version manager like nvm to easily switch between versions:
    nvm install 16
    nvm use 16
    

2. Set NODE_OPTIONS Environment Variable

  • If you cannot downgrade Node.js, you can set the NODE_OPTIONS environment variable to allow the legacy OpenSSL provider:
    export NODE_OPTIONS=--openssl-legacy-provider
    
  • Add this line to your shell configuration file (e.g., .bashrc, .zshrc) to make it persistent.

3. Update Your Build Tools

  • Ensure that your build tools (e.g., webpack, Terser) are up to date. Sometimes, newer versions of these tools are compatible with the latest Node.js versions and can handle the stricter security settings.

4. Modify package.json Scripts

  • If you’re running scripts from package.json, you can modify them to include the NODE_OPTIONS environment variable:
    "scripts": {
      "build": "NODE_OPTIONS=--openssl-legacy-provider uni-app build"
    }
    

5. Check for Compatibility Issues

  • If you’re using specific libraries or plugins, check their documentation or GitHub issues to see if others have encountered similar problems. There may be updates or workarounds available.

Example of Setting NODE_OPTIONS in a Script:

# In your build script
NODE_OPTIONS=--openssl-legacy-provider uni-app build
回到顶部