ant-design / ant-design-pro

👨🏻‍💻👩🏻‍💻 Use Ant Design like a Pro!
https://pro.ant.design
MIT License
36.51k stars 8.15k forks source link

🧐[问题]项目无法启动,error:0308010C:digital envelope routines::unsupported #9272

Closed Vulcan-W closed 2 years ago

Vulcan-W commented 3 years ago

🧐 问题描述

在用 “npm run start” 启动项目时出错,错误提示见示例代码。 nodejs版本:Node.js v17.0.1 npm版本:8.1.0

💻 示例代码

node:internal/crypto/hash:67 this[kHandle] = new _Hash(algorithm, xofLen); ^

Error: error:0308010C:digital envelope routines::unsupported at new Hash (node:internal/crypto/hash:67:19) at Object.createHash (node:crypto:130:10) at BulkUpdateDecorator.hashFactory (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184154:18) at BulkUpdateDecorator.update (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:184055:50) at OriginalSource.updateHash (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack-sources2\index.js:1:51038) at NormalModule._initBuildHash (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115961:17) at handleParseResult (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:116027:10) at D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:116119:4 at processResult (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115836:11) at D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:115900:5 at D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:35132:3 at iterateNormalLoaders (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:34958:10) at Array. (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:34949:4) at runCallbacks (D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:24341:15) at D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:24514:4 at D:\0.ceshi_ant\myapp\node_modules\@umijs\deps\compiled\webpack\5\bundle5.js:33829:16 { opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ], library: 'digital envelope routines', reason: 'unsupported', code: 'ERR_OSSL_EVP_UNSUPPORTED' }

Node.js v17.0.1

🚑 其他信息

Vulcan-W commented 3 years ago

升级npm到8.1.3,依然是错误 image

FZUKingDuck commented 3 years ago

nodejs 版本过高了, 降到16.x的版本就好了

Vulcan-W commented 3 years ago

nodejs 版本过高了, 降到16.x的版本就好了

刚开始nodejs就是16.x的,但是npm和yarn不好使,就升级到17,谁知道更不行了

chenshuai2144 commented 2 years ago

都用最新的稳定版本吧,npm 和yarn 也不要用最新的。 不然也跑不起来,社区跑的太快我们有点跟不上

FZUKingDuck commented 2 years ago

nodejs版本太高了,降到16.x的版本就好了

刚开始nodejs升级就是16.x的,但是npm和yarn不好使,就到17,谁知道更不行了 我用的版本是node14.15.5, npm 6.14.11 的版本,你可以参考一下

Vulcan-W commented 2 years ago

谢谢大家,看来我只能把系统重装回win10了。。。

chenshuai2144 commented 2 years ago

win11 也能的,我就是。

ronnycyy commented 2 years ago

package.json中做如下修改:

... "scripts": { ..., "start": "antd-tools run clean && cross-env NODE_ENV=development NODE_OPTIONS=--openssl-legacy-provider concurrently \"bisheng start -c ./site/bisheng.config.js\"", ... }

yiliang114 commented 2 years ago

node 别升到 17。 亲测 退回 12 或者 14 都可以。 装个 n, 灵活切换 node 版本吧

jayjay-3 commented 2 years ago

感谢 v12可以用

yunsii commented 2 years ago

都用最新的稳定版本吧,npm 和yarn 也不要用最新的。 不然也跑不起来,社区跑的太快我们有点跟不上

哈哈哈,真有意思 😂

cieldon32 commented 2 years ago

太不科学了, 别人17, 16 都成功的

geosmart commented 2 years ago

try export NODE_OPTIONS=--openssl-legacy-provider

zffocussss commented 2 years ago

nvm install 14

horans commented 2 years ago

try export NODE_OPTIONS=--openssl-legacy-provider

for windows user: use 'set' instead of 'export'.

for example, try following in your package.json: "start": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env UMI_ENV=dev umi dev",

yifan303 commented 2 years ago

装了nvm ,卸载17了,使用node 15就能正常跑了;

rc1021 commented 2 years ago

npm run start

linux & mac: NODE_OPTIONS=--openssl-legacy-provider && npm run start

windows: set NODE_OPTIONS=--openssl-legacy-provider && npm run start

參考 https://stackoverflow.com/a/70863115/732244

quick123official commented 2 years ago

try export NODE_OPTIONS=--openssl-legacy-provider

It works for me. Thanks!

luxingwen commented 2 years ago

如果是umi, package 的start改成这样: "start": "cross-env NODE_OPTIONS=--openssl-legacy-provider UMI_ENV=dev umi dev "

geekact commented 2 years ago

装了nvm ,卸载17了,使用node 15就能正常跑了;

哥,别老用node奇数版本啊,偶数版本才是正常升级维护的,12,14,16,18

Nymph2333 commented 2 years ago

装了nvm ,卸载17了,使用node 15就能正常跑了;

哥,别老用node奇数版本啊,偶数版本才是正常升级维护的,12,14,16,18

18也有这个问题,好像说是Webpack v5.54.0用了新的OpenSSL,老的哈希不再支持了

djllhs commented 2 years ago

set NODE_OPTIONS=--openssl-legacy-provider

It works for me. Thanks!

dogeow commented 2 years ago

n 16 就可以了

hechien commented 2 years ago

try export NODE_OPTIONS=--openssl-legacy-provider

這個非常有效,直接成功啟動,謝謝!

Delta-in-hub commented 1 year ago

try export NODE_OPTIONS=--openssl-legacy-provider

這個非常有效,直接成功啟動,謝謝!

有效,感谢。

Vulcan-W commented 1 year ago

装了nvm ,卸载17了,使用node 15就能正常跑了;

哥,别老用node奇数版本啊,偶数版本才是正常升级维护的,12,14,16,18

NVM是最佳方案b( ̄▽ ̄)d

frontend-winter commented 1 year ago

NODE_OPTIONS=--openssl-legacy-provider 亲测无效 n 16 亲测有效

yyyywwwwpppp commented 1 year ago

try export NODE_OPTIONS=--openssl-legacy-provider

for windows user: use 'set' instead of 'export'.

for example, try following in your package.json: "start": "set NODE_OPTIONS=--openssl-legacy-provider && cross-env UMI_ENV=dev umi dev",

这个是可以的运行的,npm v9 node v18 ant-design-pro-v5

lemonit-eric-mao commented 1 year ago

package.json中做如下修改:

... "scripts": { ..., "start": "antd-tools run clean && cross-env NODE_ENV=development NODE_OPTIONS=--openssl-legacy-provider concurrently \"bisheng start -c ./site/bisheng.config.js\"", ... }

这个办法是可行的,非常感谢

xsgteamx commented 1 year ago

太感谢了,昨天折磨了我一下午,vercel部署一个前端项目部署不成功。这件事情告诉我,遇到事情第一件事就是复制错误日志查谷歌。不相信错误日志相信什么!信上帝吗?

dogeow commented 1 year ago

太感谢了,昨天折磨了我一下午,vercel部署一个前端项目部署不成功。这件事情告诉我,遇到事情第一件事就是复制错误日志查谷歌。不相信错误日志相信什么!信上帝吗?

所以你是感谢谁啊

wangmeijian commented 1 year ago

nodejs 版本过高了, 降到16.x的版本就好了

好使

MUMU46 commented 1 year ago

如果是umi, package 的start改成这样: "start": "cross-env NODE_OPTIONS=--openssl-legacy-provider UMI_ENV=dev umi dev "

有效

hen128 commented 1 year ago

我也遇到了,我更改16.x就好了

WeihanLi commented 1 year ago

https://stackoverflow.com/a/69699772

You can try one of these:

  1. Downgrade to Node.js v16.

You can reinstall the current LTS version from Node.js’ website.

You can also use nvm. For Windows, use nvm-windows.

  1. Enable legacy OpenSSL provider.

On Unix-like (Linux, macOS, Git bash, etc.):

export NODE_OPTIONS=--openssl-legacy-provider

On Windows command prompt:

set NODE_OPTIONS=--openssl-legacy-provider

On PowerShell:

$env:NODE_OPTIONS = "--openssl-legacy-provider"

Reference

xsfxtsxxr commented 11 months ago

try export NODE_OPTIONS=--openssl-legacy-provider

这条命令是不是指定使用node自带的openssl,我的mac自带的LibreSSL 2.8.3,最新的都3.8.2了

xingorg1 commented 10 months ago

node版本过高,用nvm从 v18.x 切到 v16.x就好了

ChrisGanbare commented 8 months ago

挠头了半天还是在各位大佬指点下,downgrade,活过来了

humbass commented 7 months ago

nodejs 版本过高了, 降到16.x的版本就好了

果然是这个问题,感谢大佬!

dogeow commented 7 months ago

加个 .nvmrc 文件吧

dogeow commented 7 months ago

小白:都 4202 年了,环境需求最好列一下,啰嗦一点。

huangbuhuan commented 5 months ago

try export NODE_OPTIONS=--openssl-legacy-provider 谢谢

is-tongben commented 2 months ago

Resolve multiple commands at once

/* eslint-disable */
//prettier-ignore

module.exports = {
    name: "@yarnpkg/plugin-set-env",
    factory: () => {
      return {
        default: {
          hooks: {
            setupScriptEnvironment(project, scriptEnv) {
              // 执行命令的时候配置环境变量
              scriptEnv.NODE_OPTIONS = "--openssl-legacy-provider";
            },
          },
        },
      };
    },
};