@TOC
一、Vue项目启动报错如下
> front@0.1.0 serve
> vue-cli-service serve
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
INFO Starting development server...
10% building 2/5 modules 3 active ...rontsHospital\front\node_modules\eslint-loader\index.js??ref--14-0!D:\Vue\front\src\main.js E
rror: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (D:\Vue\front\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:503:5
at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:358:12
at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:68
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:68:19)
at Object.createHash (node:crypto:138:10)
at module.exports (D:\Vue\front\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\Vue\front\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:503:5
at D:\Vue\front\node_modules\webpack\lib\NormalModule.js:358:12
at D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (D:\Vue\front\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at D:\Vue\front\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at D:\Vue\front\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
Node.js v20.11.0
解决方式1:NodeJS版本过高
解决方式2:添加项目启动参数
在npm run serve项目启动前声明条件变量
//windows
$env:NODE_OPTIONS="--openssl-legacy-provider"
npm run serve
//Linux
NODE_OPTIONS=--openssl-legacy-provider npm run serve
PS D:\Vue\front> $env:NODE_OPTIONS="--openssl-legacy-provider"
PS D:\Vue\front> npm run serve
DONE Compiled successfully in 12694ms 15:30:15
App running at:
- Local: http://localhost:8080/
- Network: http://192.168.1.10:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
评论