当前位置: 首页 > news >正文

Node:解决Error: error:0308010C:digital envelope routines::unsupported的解决方法

问题描述

在使用vuepress搭建博客的时候,运行项目发现报错了,检查了node的版本是18+,之前用的是16或14的版本,现在报:Error: error:0308010C:digital envelope routines::unsupported错误。

查找了一些资料,大致明白了报错的原因:

主要是因为node 17 版本发布了 OpenSSL3.0 对算法和秘钥大小增加了更为严格的限制,node 17之前版本没影响,但17和之后版本会出现这个错误。这不是巧了嘛这不是,我正好是用的18的,所以报错了。

error: error:0308010C:digital envelope routines::unsupportedat new Hash (node:internal/crypto/hash:71:19)at Object.createHash (node:crypto:133:10)

解决方法:

打开我的vue项目,然后在项目中 package.json 的 scripts 中新增 SET NODE_OPTIONS=–openssl-legacy-provider。

没改之前的代码:

    "scripts": {"dev": "vue-cli-service serve","build:prod": "vue-cli-service build"},

改之后的代码:

    "scripts": {"dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve","build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build"},
http://www.lryc.cn/news/405894.html

相关文章:

  • spring boot(学习笔记第十四课)
  • Android 11 Unable to start/bind service
  • 走难而正确的路并持之以恒
  • 规范:Redis规范
  • 比较 WordPress 、 Baklib 和 BetterDocs
  • Redis 哨兵搭建
  • HackTheBox--Knife
  • Linux_实现TCP网络通信
  • 正则表达式与文本三剑客之grep
  • 微信小程序开发:项目程序代码构成
  • 【云原生】Kubernetes微服务Istio:介绍、原理、应用及实战案例
  • 【Docker】Docker-consul容器服务自动发现与注册
  • Go 1.22 remote error: tls: handshake failure
  • 迈向通用人工智能:AGI的到来与社会变革展望
  • 大模型额外篇章三:vercel搭建openai中转服务器
  • 使用 jQuery 中的 this 实例
  • 下载最新版Anaconda、安装、更换源、配置虚拟环境并在vscode中使用
  • 极狐GitLab Git LFS(大文件存储)如何管理?
  • 迭代学习笔记
  • 【安全】系统安全设计规范(DOC完整版)
  • windows常用命令整理
  • 视频处理基础知识1
  • Linux退不出vim编辑模式
  • TikTok养号的网络环境及相关代理IP知识
  • 过程调用和数组的分配访问
  • TeamViewer手机端APP提示:请先验证账户
  • 【SpringBoot】分页查询
  • 微软CrowdStrike驱动蓝屏以及内核签名
  • Spring中Bean的循环依赖
  • Java二十三种设计模式-代理模式模式(8/23)