首先fork此项目https://github.com/CIPHERTron/portfolio,我fork后,得到的项目地址是https://github.com/brightmann/cp ,
访问https://github.com/brightmann/cp/tree/main/content/articles,在此处新建源帖(即add file),我新建了源帖fh.md,内容为:
---
title: 战马
date: '20-06-2026 22:05:00'
slug: 'fh'
previewImage: '/images/articles/poetry-cover.png'
description: '这是一篇文章'
category: selected
tags:
- misc1
- misc2
- misc3
---
此处写正文或html codes.
( 详见https://github.com/brightmann/cp/blob/main/content/articles/fh.md?plain=1)
然后,访问vercel.com/new ,导入项目https://github.com/brightmann/cp
Build Command栏填入export NODE_OPTIONS=--openssl-legacy-provider && yarn build
Install Command栏填入yarn
然后点击底部的deploy按钮,等待部署完成。部署完成后,我得到网址:
https://cp-c7vi.vercel.app/
项目地址:
https://github.com/CIPHERTron/portfolio
https://github.com/brightmann/cp
演示博客:
https://cp-c7vi.vercel.app/
https://cp-c7vi.vercel.app/articles
https://cp-c7vi.vercel.app/articles/fh 不能显示视频
( https://cp-fish.netlify.app/articles
https://cp-fish.netlify.app/articles/fh 不能显示视频)
(The build fails with OpenSSL errors: line 77 (repeated throughout the stack) and the detailed Node/OpenSSL error at line 267 - line 285.
The build is running on Node.js v22.23.0: line 286.
Netlify reports the build command failed: line 71 and lines 294-298.
Error type and cause:
ERR_OSSL_EVP_UNSUPPORTED (Error: error:0308010C:digital envelope routines::unsupported). This happens because Node 17+ (here Node 22) ships OpenSSL 3, which breaks older tooling (webpack 4 / older crypto usage) that expects OpenSSL 1.x behavior. The project is forcing webpack 4 (see line 68), so the crypto/createHash calls fail under OpenSSL 3 and throw ERR_OSSL_EVP_UNSUPPORTED, causing the build to abort. see line 77 and line 267.
Solution
You have two practical fixes — choose one (recommended: change Node to a supported LTS) —
Option A — Recommended: use Node 18 LTS (or 16/18) on Netlify
Add a Node version file so Netlify uses a Node version compatible with webpack 4:
Create a file named .nvmrc (in repo root) containing:
18
OR add an engines entry to package.json:
"engines": {
"node": "18.x"
},
Commit and push the file. Netlify will pick up the Node version on the next deploy.
See Netlify docs for changing Node versions: https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-and-javascript
Why: Node 18 uses OpenSSL 1.1.x behavior compatibility that avoids the ERR_OSSL_EVP_UNSUPPORTED with older webpack 4 builds.
Option B — Workaround: enable OpenSSL legacy provider (quick fix)
In Netlify UI, set an environment variable for your site:
Key: NODE_OPTIONS
Value: --openssl-legacy-provider Or change the build command to prepend the env var, e.g. in Netlify Build settings set the Build command to:
export NODE_OPTIONS=--openssl-legacy-provider && yarn build
Redeploy.
Why: This tells Node to use the legacy OpenSSL provider so createHash calls in older webpack versions work. This is a workaround; upgrading Node or webpack is preferable long-term.
Optional longer-term fixes
Remove or update the custom webpack configuration (so your Next.js can use webpack 5) and/or upgrade Next.js to a version compatible with modern Node/OpenSSL and webpack 5. That will eliminate the need for the legacy provider or downgrading Node.
Notes
If you pick Option A, commit .nvmrc or package.json engines before changing Netlify settings so the version is tracked in the repo.)
No comments:
Post a Comment