ChatGPT解决这个技术问题 Extra ChatGPT

错误消息“错误:0308010C:数字信封例程::不支持”

我创建了默认的 IntelliJ IDEA React 项目并得到了这个:

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:130:10)
    at module.exports (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:471:10)
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:503:5
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/webpack/lib/NormalModule.js:358:12
    at /Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/Users/user/Programming Documents/WebServer/untitled/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
/Users/user/Programming Documents/WebServer/untitled/node_modules/react-scripts/scripts/start.js:19
  throw err;
  ^

这似乎是最近的问题 - webpack ran into this 4 days ago and is still working on it

该问题链接中提到的解决方法对您有用吗?
我在使用下一个 js 时遇到了同样的错误,我降级了我的节点版本,现在该错误不会出现。
@Mike'Pomax'Kamermans Webpack 的问题没有解决方法:/ 这就是我问这个问题的原因。
有吗? github.com/webpack/webpack/issues/14532#issuecomment-947012063 是在 6 天前发布的(从那时起,人们进行了很多后续行动,询问确切的使用方法,并得到了很多人的解释)。
使用 LTS 版本的 Node (V16) 而不是 V17 为我们解决了这个问题。

A
Ajoy Karmakar

现在有两个选项-

1.尝试卸载Node.js 17+版本并重新安装Node.js 16+版本

您可以从他们的官方网站重新安装当前的 LTS 节点 js 版本。或更具体的从这里下载;

你可以使用 NVM (Node Version Manager) Linux 和 Mac 用户可以使用这个 nvm 包 - https://github.com/nvm-sh/nvm Windows 用户可以使用这个 nvm 包 - https://github.com/coreybutler/ nvm-windows

Linux 和 Mac 用户可以使用这个 nvm 包 - https://github.com/nvm-sh/nvm

Windows 用户可以使用这个 nvm 包 - https://github.com/coreybutler/nvm-windows

2.打开终端并按照说明粘贴这些:

Linux & Mac OS (windows git bash)-

export NODE_OPTIONS=--openssl-legacy-provider

Windows 命令提示符 -

set NODE_OPTIONS=--openssl-legacy-provider

参考 link


我把这个放在哪里?
对我来说,这个命令失败 /usr/local/Cellar/node/17.0.1/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
一个解释将是有序的。例如,为什么有必要?它应该达到什么目的?为什么它有效?有什么安全隐患(如果有的话)?为什么这个答案与其他答案完全不同?请通过 editing (changing) your answer 回复,而不是在评论中(没有“编辑:”、“更新:”或类似内容 - 答案应该看起来好像是今天写的)。
不推荐此解决方案,尝试卸载 Node.js 17+ 版本并重新安装 Node.js 16+ 版本。
做了set NODE_OPTIONS=--openssl-legacy-provider它给出了同样的错误
a
a1cd

在你的 package.json: 改变这一行

"start": "react-scripts start"

"start": "react-scripts --openssl-legacy-provider start"

但请注意,--openssl-legacy-provider 意味着您现在几乎可以肯定是 running with known insecure SSL,因此这可能会减轻症状,但可能无法解决根本问题。
但当然,在运行 localhost 时这是可以接受的。在新发布的 VS 2022 中,从头开始启动 react-app,让 VS 2022 为您创建自签名证书,仍然会导致示例项目崩溃。当使用 NPM 命令行“npx create-react-app react-core-test”从头开始创建 react-project 时,这也是一个问题。我在运行 WINdows 10 和 Windows 11 的两个不同环境中对此进行了测试。
请参阅 Ashok 的回答。这是保持 SSL 无漏洞工作的正确解决方案,它对我有用。
我不明白以某种方式将节点 16 与 openssl 1.x 一起使用会比在传统模式下将节点 17 与 openssl 3 一起使用更安全。 OpenSSL 在 v3 中做了一些更严格的规定。您要么以一种方式克服该限制,要么以另一种方式击败该限制。这两种方法可能同样不安全。
A
Ashok Bhobhiya

如果我们使用当前的 LTS 版本的 Node.js,那么这个错误就不会出现。将您的 Node.js 版本降级到当前的 LTS 版本 (16.13.0)。

可以有多种方法来安装所需的版本。其中之一是使用 nvm(Node.js 版本管理器)。

第 1 步:安装 nvm(如果未安装,请按照使用 Node Version Manager (nvm) 在本地安装 Node.js)

第 2 步:nvm 安装 16.13.0(或 lts)


但是...为什么新版本与旧代码不兼容? node 是世界上最大的编程工具之一,他们不会只是创建一个不向后兼容的新版本 nodejs(我猜他们会因为他们做到了,但你明白我的意思)
强制降级
始终将 LTS 用于实际应用程序,它解决了这个问题。
16 之后的新 LTS 是否应该恢复到旧 SSL?我假设问题将是相同的,只是推迟到以后,并且使用 LTS 16 是一个临时解决方案。
H
Heretic Monkey

这是 Node.js 版本。

我在 Node.js 17 上遇到此错误,但是当我使用 nvm 将我的 Node.js 版本切换到旧版本 (16) 时,这很好。


同样在这里。恢复到节点 16 解决了该问题。
是的。刚刚尝试运行安全帽测试时遇到。很想听听造成它的原因。
你是对的,将 npm 版本回滚到 16.13.x 有效!
如果您使用的是包管理器 Chocolatey,则只需 choco uninstall nodejschoco install nodejs-lts 即可安装 LTS 版本的节点。
不知何故,这个错误也在节点 v16 上发生在我身上......
G
Gary Bao 鲍昱彤

一些热门答案不起作用。

export NODE_OPTIONS=--openssl-legacy-provider

并且一些热门答案不适用,修改 package.json 文件:

"start": "react-scripts --openssl-legacy-provider start"

这是由与 OpenSSL 的最新 node.js V17 兼容问题引起的,请参阅 GitHub 上的 thisthis 问题。

最简单的事情就是从 node.js V17 降级到 node.js V16。请参阅 this post,了解如何降级 node.js


确认将版本降级为 V.16 解决了该问题。 nvm install v16 && nvm alias default v16 && nvm use v16
从 v17 降级到 v16 解决了这个问题
是的,这个解决方案非常有效。我的工作站中有 V17 并面临这个问题。而我的 GitHub 操作中的相同 package.json 使用 V16,并且没有发生此错误。谢谢!
P
Peter Mortensen

我在 GitHub 上找到了以下命令:

对于 Windows,在 cmd 中使用以下命令:

set NODE_OPTIONS=--openssl-legacy-provider

对于 Unix,使用:

export NODE_OPTIONS=--openssl-legacy-provider

谢谢,它奏效了。但是你能解释一下为什么会发生这种情况以及这个命令是如何解决这个问题的吗?
为我工作谢谢,但这不是一个永久的解决方案。
@AliKHalili 这个 github 链接解释了它:- github.com/webpack/webpack/issues/14532#issuecomment-947012063
@AbdulBasitRishi 是的,很遗憾不是。更容易的是降级节点版本。似乎是 Node.js 中的一个新版本问题。可能他们会修复它
这本质上是 Ajoy Karmakar's answer 的副本(也没有任何解释)。
P
Peter Mortensen

这对我有用(从 Node.js 17 降级到 Node.js 16):

nvm install --lts
nvm use --lts

使用 Node.js Version Manager (for Windows)。


它对我有用,但我必须在没有破折号的情况下执行 nvm install lts(Windows 10 - Powershell)。
它对我有用,但在我的机器上 nvm install --lts 已经使用它安装的版本,所以不需要执行 nvm use
P
Peter Mortensen

无法构造变压器:错误:错误:0308010C:数字信封例程::不支持

解决上述错误的最简单和最简单的解决方案是将 Node.js 降级到 v14.18.1。然后只需删除文件夹 node_modules 并尝试重建您的项目,您的错误必须得到解决。


这是奇怪的措辞:|尝试在代码 markdown help 周围使用 ` 字符
版本 v16.13.0 而不是 17.x 对我来说也很有效。我也不需要删除 node_modules 文件夹。
我正在运行节点版本 14.17.3,但我仍然遇到此问题。
A
Abdul Basit Rishi

这个解决方案对我有用。

此错误出现在 Node.js 版本 17+ 中,因此请尝试降级 Node.js 版本。

从计算机上卸载 Node.js。从 https://nodejs.org/download/release/v16.13.0/ 下载 Node.js 版本 16 并再次安装

就这样。


但为什么?为什么node v17有问题
@Evergreen 这很可能是 webpack4 问题,同样在 17 版中,Node.js 开发人员已弃用导入映射规范中不支持的尾部斜杠模式映射。 Node.js 开发人员需要尽快解决这个问题。
是的,我希望 node js 作为一个如此广泛使用的产品,会更加关注向后兼容性。
或者,如果您使用的是 nvm(节点版本管理器)(如果您不使用,则应该使用,所以请花点时间这样做...),您只需输入 nvm install 16 即可去。
D
Dorian

查看

node -v
v17.4.0

然后回滚到使用 nvm 的 node --lts (node v16.13.2 (npm v8.1.2))

official install nvm

对于 bash 外壳

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

对于 zsh 外壳

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh

nvm安装后

nvm install --lts

查看

 node -v 

v16.13.2

重试


我正在使用 v16.13.2 并且出现此错误
这对我有用,我也确实先更新了反应脚本,所以其中一个解决了这个问题。
P
Peter Mortensen

我在 Docker 构建中遇到了这个问题,我在 Docker 文件中添加了这一行:

RUN export NODE_OPTIONS=--openssl-legacy-provider && yarn build && yarn install --production --ignore-scripts --prefer-offline

对于本地开发,请在文件 package.json 中添加开关。


NODE_OPTIONS=--openssl-legacy-provider 是命令行参数,在运行 yarn build 时应该存在。与 Docker 无关。当您构建应用程序的 docker 映像时,上面的行就是您用来构建的
这几乎与 Ajoy Karmakar's answer 重复。这个也缺少解释。你能提供一个解释吗?例如,为什么需要 --openssl-legacy-provider?为什么所有的 yarn 东西?请通过 editing (changing) your answer 回复,而不是在评论中(没有“编辑:”、“更新:”或类似的 - 答案应该看起来好像是今天写的)。
上面的答案在 docker 文件中运行,yarn 作为包管理器。这将帮助使用类似环境且无法通过提供的其他答案解决的用户。我会用更多的解释来编辑答案。谢谢
P
Pablo Yabo

原因:

这个错误是因为 node.js 17 使用了 OpenSSL3,它改变了 md 系列(包括 md4)的初始化上下文的代码,这是一个破坏性的变化。如果您使用 docker build 构建应用程序,也会出现该错误,因为它默认拉取最新版本的 Node.JS。

安装 nvm 节点版本管理器:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

安装最新的 LTS 版本:

nvm install --lts

使用 LTS 版本:

nvm use --lts

完毕!

来源:https://itsmycode.com/error-digital-envelope-routines-unsupported/


K
Karthik Rana

运行审计为我解决了问题

npm audit fix --force

P
Peter Mortensen

如果您遇到此错误并且不想更改主要配置,则使用以下方法可以轻松解决。不过,我不确定它是否被推荐为一种好的做法。

随意纠正它。

最初,假设这是我的 package.json 文件的脚本部分:

...
"version": "1.0.0",
  "scripts": {
    ...
    "build": "npm run build:test-app:testing",
    "build:test-app:testing": "ng build test-app --deploy-url  https://test-app.com/ --configuration=test-config",
    ...
  },
  "private": true,
...

要使用此 export NODE_OPTIONS=--openssl-legacy-provider,您可以执行以下操作:

"version": "1.0.0",
  "scripts": {
....
    "build": "NODE_OPTIONS=--openssl-legacy-provider npm run build:test-app:testing”,
    "build:test-app:testing": "NODE_OPTIONS=--openssl-legacy-provider ng build test-app --deploy-url  https://test-app.com/ --configuration=test-config"
...
  },
  "private": true,

记下构建脚本。我添加了一个选项:NODE_OPTIONS=--openssl-legacy-provider

这有助于解决 Node.js 版本 17 中的此错误。

对于那些可以灵活更改构建系统的 Node.js 版本的人,只需切换到低于 17 的版本,例如版本 16。

对于 Docker,最初使用 this 的用例,总是拉取最新版本:

...
FROM node:alpine
...

你可以切换到类似的东西:

...
FROM node:16-alpine3.12
...

R
Rob Juurlink

使用 VueJS 时遇到此问题。

使用 -openssl-legacy-provider 的一个缺点是旧 Node 版本不支持它。提供此标志时,较旧的节点版本根本不会运行。
但我仍然希望与 Node v16 及更早版本兼容。

VueJS 使用 md4 算法来生成哈希(实际上它是 WebPack 的底层)。出于这些目的,md4 可以很容易地被 md5 替换。使用的算法类型在大多数地方都是硬编码的,因此无法配置另一种算法。

所以我想出了另一个解决方法。拦截来自 crypto 模块的原始 createHash() 调用并将其替换为修改版本的函数。这是我的 vue.config.js 文件的开头:

const crypto = require('crypto');

/**
 * md4 algorithm is not available anymore in NodeJS 17+ (because of lib SSL 3).
 * In that case, silently replace md4 by md5 algorithm.
 */
try {
  crypto.createHash('md4');
} catch (e) {
  console.warn('Crypto "md4" is not supported anymore by this Node version');
  const origCreateHash = crypto.createHash;
  crypto.createHash = (alg, opts) => {
    return origCreateHash(alg === 'md4' ? 'md5' : alg, opts);
  };
}

P
Peter Mortensen

这在我的应用程序博览会中对我有用(从 Node.js 17 降级到 Node.js 12 或 14)。

如果您安装了 nvm,您可以更改节点的版本:

首先在 nvm 中检查 Node.js 的版本:

nvm list

二、安装12或14版本:

nvm install v12.22.8

A
Art Mary

运行开发服务器时与节点版本 v18.0.0 和 nuxt 框架版本 2.15 相同的错误,将通过以下方式修复:

"scripts": {
  "dev": "NODE_OPTIONS=--openssl-legacy-provider nuxt"
}

D
Donghua Liu

我在使用节点 v18.4.0 构建 hoppscotch 时遇到了同样的错误,set NODE_OPTIONS=--openssl-legacy-provider 救了我!

D:\code\rust\hoppscotch-app\hoppscotch>pnpm install && pnpm run generate
Scope: all 5 workspace projects
Lockfile is up-to-date, resolution step is skipped
Already up-to-date
packages/codemirror-lang-graphql prepare$ rollup -c
│ Browserslist: caniuse-lite is outdated. Please run:
│   npx browserslist@latest --update-db
│   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
│
│ src/index.js → dist/index.cjs, ./dist...
│ created dist/index.cjs, ./dist in 2.8s
└─ Done in 4.8s
packages/hoppscotch-data prepare$ tsup src --dts
[20 lines collapsed]
│ CJS dist\chunk-LZ75CAKS.js     13.00 B
│ DTS Build start
│ DTS ⚡️ Build success in 2261ms
│ DTS dist\index.d.ts              714.00 B
│ DTS dist\rest\index.d.ts         2.18 KB
│ DTS dist\graphql\index.d.ts      589.00 B
│ DTS dist\collection\index.d.ts   1.30 KB
│ DTS dist\rest\content-types.d.ts 473.00 B
│ DTS dist\rest\HoppRESTAuth.d.ts  882.00 B
│ DTS dist\type-utils.d.d.ts       1.00 B
└─ Done in 3.8s
packages/hoppscotch-js-sandbox postinstall$ pnpm run build
│ > @hoppscotch/js-sandbox@1.0.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-js-sandbox
│ > npx tsc
└─ Done in 8.7s
. prepare$ husky install
│ husky - Git hooks installed
└─ Done in 300ms
packages/hoppscotch-app postinstall$ pnpm run gql-codegen
[12 lines collapsed]
│ [14:58:01] Load GraphQL documents [started]
│ [14:58:01] Load GraphQL documents [completed]
│ [14:58:01] Generate [started]
│ [14:58:01] Generate [completed]
│ [14:58:01] Generate helpers/backend/backend-schema.json [completed]
│ [14:58:02] Load GraphQL documents [completed]
│ [14:58:02] Generate [started]
│ [14:58:02] Generate [completed]
│ [14:58:02] Generate helpers/backend/graphql.ts [completed]
│ [14:58:02] Generate outputs [completed]
└─ Done in 4s

> hoppscotch-app@2.2.1 generate D:\code\rust\hoppscotch-app\hoppscotch
> pnpm -r do-build-prod

Scope: 4 of 5 workspace projects
packages/hoppscotch-js-sandbox do-build-prod$ pnpm run build
│ > @hoppscotch/js-sandbox@1.0.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-js-sandbox
│ > npx tsc
└─ Done in 7.5s
packages/hoppscotch-app do-build-prod$ pnpm run generate
│ > hoppscotch-app@2.2.1 generate D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-app
│ > nuxt generate --modern
│ i Sentry reporting is disabled (no DSN has been provided)
│ i Production build
│ i Bundling only for client side
│ i Target: static
│ i Using components loader to optimize imports
│ i Discovered Components: node_modules/.cache/nuxt/components/readme.md
│ √ Builder initialized
│ √ Nuxt files generated
│ i Compiling Client
│  ERROR  Error: error:0308010C:digital envelope routines::unsupported
│     at new Hash (node:internal/crypto/hash:67:19)
│     at Object.createHash (node:crypto:133:10)
│     at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│     at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_module
│     at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\l
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at runSyncOrAsync (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at Array.<anonymous> (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loa
│     at Storage.finished (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\enhanced-resolve@4.5.0\node_modules\e
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\enhanced-resolve@4.5.0\node_modules\enhanced-resolve\li
│  WARN  Browserslist: caniuse-lite is outdated. Please run:
│   npx browserslist@latest --update-db
│   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
│  ERROR  error:0308010C:digital envelope routines::unsupported
│   at new Hash (node:internal/crypto/hash:67:19)
│   at Object.createHash (node:crypto:133:10)
│   at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\u
│   at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\
│   at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js:5
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js:3
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Loader
│   at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\lo
│   at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\lo
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Loader
│   at context.callback (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\babel-loader@8.2.3_@babel+core@7.16.12\node_modules\babel
│ D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\LoaderRunne
│                       throw e;
│                       ^
│ Error: error:0308010C:digital envelope routines::unsupported
│     at new Hash (node:internal/crypto/hash:67:19)
│     at Object.createHash (node:crypto:133:10)
│     at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│     at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_module
│     at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\l
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at context.callback (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\load
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\cache-loader@4.1.0_webpack@4.46.0\node_modules\cache-lo
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\graceful-fs@4.2.8\node_modules\graceful-fs\graceful-fs.
│     at FSReqCallback.oncomplete (node:fs:201:23) {
│   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
│   library: 'digital envelope routines',
│   reason: 'unsupported',
│   code: 'ERR_OSSL_EVP_UNSUPPORTED'
│ }
│ Node.js v18.4.0
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 8.3s
D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-app:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  hoppscotch-app@2.2.1 do-build-prod: `pnpm run generate`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

D:\code\rust\hoppscotch-app\hoppscotch>npx browserslist@latest --update-db
Need to install the following packages:
  browserslist@4.20.4
Ok to proceed? (y) y
Latest version:     1.0.30001357
Updating caniuse-lite version
$ pnpm up caniuse-lite
caniuse-lite has been successfully updated

No target browser changes

D:\code\rust\hoppscotch-app\hoppscotch>pnpm install && pnpm run generate
Scope: all 5 workspace projects
Lockfile is up-to-date, resolution step is skipped
Already up-to-date
packages/codemirror-lang-graphql prepare$ rollup -c
│ Browserslist: caniuse-lite is outdated. Please run:
│   npx browserslist@latest --update-db
│   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
│
│ src/index.js → dist/index.cjs, ./dist...
│ created dist/index.cjs, ./dist in 2.8s
└─ Done in 4.8s
packages/hoppscotch-data prepare$ tsup src --dts
[20 lines collapsed]
│ CJS dist\chunk-JUWXSDKJ.js     1010.00 B
│ DTS Build start
│ DTS ⚡️ Build success in 2250ms
│ DTS dist\index.d.ts              714.00 B
│ DTS dist\rest\index.d.ts         2.18 KB
│ DTS dist\graphql\index.d.ts      589.00 B
│ DTS dist\collection\index.d.ts   1.30 KB
│ DTS dist\rest\content-types.d.ts 473.00 B
│ DTS dist\rest\HoppRESTAuth.d.ts  882.00 B
│ DTS dist\type-utils.d.d.ts       1.00 B
└─ Done in 3.7s
packages/hoppscotch-js-sandbox postinstall$ pnpm run build
│ > @hoppscotch/js-sandbox@1.0.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-js-sandbox
│ > npx tsc
└─ Done in 8.5s
. prepare$ husky install
│ husky - Git hooks installed
└─ Done in 335ms
packages/hoppscotch-app postinstall$ pnpm run gql-codegen
[12 lines collapsed]
│ [15:02:37] Load GraphQL documents [started]
│ [15:02:37] Load GraphQL documents [completed]
│ [15:02:37] Generate [started]
│ [15:02:37] Generate [completed]
│ [15:02:37] Generate helpers/backend/backend-schema.json [completed]
│ [15:02:38] Load GraphQL documents [completed]
│ [15:02:38] Generate [started]
│ [15:02:38] Generate [completed]
│ [15:02:38] Generate helpers/backend/graphql.ts [completed]
│ [15:02:38] Generate outputs [completed]
└─ Done in 3.8s

> hoppscotch-app@2.2.1 generate D:\code\rust\hoppscotch-app\hoppscotch
> pnpm -r do-build-prod

Scope: 4 of 5 workspace projects
packages/hoppscotch-js-sandbox do-build-prod$ pnpm run build
│ > @hoppscotch/js-sandbox@1.0.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-js-sandbox
│ > npx tsc
└─ Done in 6.9s
packages/hoppscotch-app do-build-prod$ pnpm run generate
│ > hoppscotch-app@2.2.1 generate D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-app
│ > nuxt generate --modern
│ i Sentry reporting is disabled (no DSN has been provided)
│ i Production build
│ i Bundling only for client side
│ i Target: static
│ i Using components loader to optimize imports
│ i Discovered Components: node_modules/.cache/nuxt/components/readme.md
│ √ Builder initialized
│ √ Nuxt files generated
│ i Compiling Client
│  ERROR  Error: error:0308010C:digital envelope routines::unsupported
│     at new Hash (node:internal/crypto/hash:67:19)
│     at Object.createHash (node:crypto:133:10)
│     at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│     at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_module
│     at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\l
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at runSyncOrAsync (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at Array.<anonymous> (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loa
│     at Storage.finished (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\enhanced-resolve@4.5.0\node_modules\e
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\enhanced-resolve@4.5.0\node_modules\enhanced-resolve\li
│  WARN  Browserslist: caniuse-lite is outdated. Please run:
│   npx browserslist@latest --update-db
│   Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
│  ERROR  error:0308010C:digital envelope routines::unsupported
│   at new Hash (node:internal/crypto/hash:67:19)
│   at Object.createHash (node:crypto:133:10)
│   at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\u
│   at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\
│   at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js:5
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js:3
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Loader
│   at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\lo
│   at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\lo
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Loader
│   at context.callback (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader
│   at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\babel-loader@8.2.3_@babel+core@7.16.12\node_modules\babel
│ D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\LoaderRunne
│                       throw e;
│                       ^
│ Error: error:0308010C:digital envelope routines::unsupported
│     at new Hash (node:internal/crypto/hash:67:19)
│     at Object.createHash (node:crypto:133:10)
│     at module.exports (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib
│     at NormalModule._initBuildHash (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_module
│     at handleParseError (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\l
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\webpack@4.46.0\node_modules\webpack\lib\NormalModule.js
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at iterateNormalLoaders (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\loader-runner\lib\Load
│     at context.callback (D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\loader-runner@2.4.0\node_modules\load
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\cache-loader@4.1.0_webpack@4.46.0\node_modules\cache-lo
│     at D:\code\rust\hoppscotch-app\hoppscotch\node_modules\.pnpm\graceful-fs@4.2.8\node_modules\graceful-fs\graceful-fs.
│     at FSReqCallback.oncomplete (node:fs:201:23) {
│   opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
│   library: 'digital envelope routines',
│   reason: 'unsupported',
│   code: 'ERR_OSSL_EVP_UNSUPPORTED'
│ }
│ Node.js v18.4.0
│  ELIFECYCLE  Command failed with exit code 1.
└─ Failed in 8.2s
D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-app:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  hoppscotch-app@2.2.1 do-build-prod: `pnpm run generate`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.

D:\code\rust\hoppscotch-app\hoppscotch>echo %NODE_OPTIONS%
%NODE_OPTIONS%

D:\code\rust\hoppscotch-app\hoppscotch>set NODE_OPTIONS=--openssl-legacy-provider

D:\code\rust\hoppscotch-app\hoppscotch>echo %NODE_OPTIONS%
--openssl-legacy-provider

D:\code\rust\hoppscotch-app\hoppscotch>pnpm run generate

> hoppscotch-app@2.2.1 generate D:\code\rust\hoppscotch-app\hoppscotch
> pnpm -r do-build-prod

Scope: 4 of 5 workspace projects
packages/hoppscotch-js-sandbox do-build-prod$ pnpm run build
│ > @hoppscotch/js-sandbox@1.0.0 build D:\code\rust\hoppscotch-app\hoppscotch\packages\hoppscotch-js-sandbox
│ > npx tsc
└─ Done in 7.1s
packages/hoppscotch-app do-build-prod$ pnpm run generate
[732 lines collapsed]
│ √ Generated route "/vi/enter"
│ √ Generated route "/vi/graphql"
│ √ Generated route "/vi/join-team"
│ √ Generated route "/vi/profile"
│ √ Generated route "/vi/realtime"
│ √ Generated route "/vi/settings"
│ √ Generated route "/"
│ √ Client-side fallback created: 404.html
│ i Generating sitemaps
│ √ Generated /sitemap.xml
└─ Done in 6m 37.1s

D:\code\rust\hoppscotch-app\hoppscotch>

n
neo post modern

如果您使用的是 react-scripts,您现在可以简单地升级到似乎已解决此问题的版本 5.0.0(或更高版本)(it includes a newer version of webpack)。


P
Peter Mortensen

我在使用 Node.js 17.0.1 时遇到了同样的问题。我按照以下步骤解决了它:

打开控制面板 → 程序和功能 → Node.js 并通过右键单击卸载 Node.js

转到网站 https://nodejs.org/en/ 并下载版本并安装。


关于“控制面板→程序和功能”:大概在Windows上?
P
Peter Mortensen

转到:https://nodejs.org/en/

并为大多数用户下载推荐版本。

然后从您的 PC 上卸载 Node.js 并安装推荐的版本。

据我了解,这是开发团队的问题。他们会尽快修复它,但同时使用推荐的版本,一切都会好起来的。


E
Enes

如果您在使用 GatsbyJs 时遇到此错误,您只需将节点版本降级为长期支持即可。没有其他的救赎


P
Peter Mortensen

尝试:

npm create react-app --template typescript foo --use-npm

一个解释将是有序的。例如,想法/要点是什么?它有什么作用?它是如何工作的?为什么它有效?请通过 editing (changing) your answer 回复,而不是在评论中(没有“编辑:”、“更新:”或类似内容 - 答案应该看起来好像是今天写的)。
O
Oded BD

在 Dockerfile 上,您应该添加:

ENV NODE_OPTIONS=--openssl-legacy-provider

几乎重复:Ajoy Karmakar's answer(也没有任何解释)
我希望清楚如何与 Docker 一起使用
P
Peter Mortensen

我今天遇到了这个问题,并通过使用“nvm”切换 Node.js 版本来解决它。

我一直在使用 Node.js、Next.jsReact 处理几个个人项目...我经常遇到的情况是,我不记得我使用的是哪个版本的 Node.js哪个项目。

所以通常我会尝试将 Node.js 16 用于当前使用 Node.js 14 的项目(我目前使用的是 Node.js 17)。

我还没有找到更好的方法来记住每个项目的 Node.js 版本,所以我通常会在 readme.MD 中保存启动应用程序所需的所有命令。


F
FXLima

在 Angular.io 项目中,Nodes.js 的接受(不支持)版本是 v16.xx

在 Nodes v17.x 版本中,出现此问题中描述的相同错误。

解决方案:

卸载节点并重新安装版本 v16.x(适用于 Windows)。


我的开发环境: - Angular CLI:12.2.1 - 节点:16.14.0(不支持) - 包管理器:npm 7.5.6 - 操作系统:win32 x64
M
Matic Kogovšek

您需要将 react-scripts 更新到最新版本

npm update react-scripts --save

这对我不起作用。 :/
N
Nkoro Joseph Ahamefula

https://i.stack.imgur.com/hUWXy.png

这可能不是每个人的问题的答案。但是对于在 docker 中运行 node 17 及以上版本的任何人来说,正如大家所说的那样降级会有所帮助。不需要 open-legacy-sslprovider。 Dockerfile 中的一个简单切换

From node

使用

From node:16.* 

在 docker 中修复了这个问题。


这对我有用,我没有使用 docker。降级到节点 16 解决了我的问题。 ` nvm 使用 16 rm -rf node_modules rm yarn.lock yarn install yarn build `
g
ggorlen

对于 Angular 应用程序:

您还可以编辑 package.json 中的 npm start 脚本。代替

"start": "ng serve -o"

"start": "set NODE_OPTIONS=--openssl-legacy-provider && ng serve -o"

当您在终端/命令行中运行 npm run start 时,它会首先设置 NODE_OPTIONS 以避免该问题。


P
Peter Mortensen

在终端(OS X)中,只需像这样降级:

sudo n 16.13.0

关注公众号,不定期副业成功案例分享
关注公众号

不定期副业成功案例分享

领先一步获取最新的外包任务吗?

立即订阅