问题描述
提示:这里描述项目中遇到的问题:
npm run serve出现下面的报错问题
Debugger attached.
INFO Starting development server...
10% building 2/2 modules 0 active(node:60792) [DEP0111] DeprecationWarning: Access to process.binding('http_parser') is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
10% building 2/5 modules 3 active ...ader\index.js??ref--14-2!D:\git\vue3-todo-ts\node_modules\eslint-loader\index.js??ref--13-0!D:\git\vue3-todo-ts\src\main.tsDebugger attached.
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:138:10)
at module.exports (D:\git\vue3-todo-ts\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:503:5
at D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:358:12
at D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array.<anonymous> (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\git\vue3-todo-ts\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\git\vue3-todo-ts\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
Waiting for the debugger to disconnect...
node:internal/crypto/hash:69
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:69:19)
at Object.createHash (node:crypto:138:10)
at module.exports (D:\git\vue3-todo-ts\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:471:10)
at D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:503:5
at D:\git\vue3-todo-ts\node_modules\webpack\lib\NormalModule.js:358:12
at D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array.<anonymous> (D:\git\vue3-todo-ts\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (D:\git\vue3-todo-ts\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at D:\git\vue3-todo-ts\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at D:\git\vue3-todo-ts\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v20.0.0
Waiting for the debugger to disconnect...
解决方案:
提示:这里填写该问题的具体解决方案:
-
1、方法一:文章来源:https://www.toymoban.com/news/detail-799588.html
- 在命令行修改环境变量:
$env:NODE_OPTIONS="--openssl-legacy-provider"
- 在启动项目:
yarn start
- 在命令行修改环境变量:
-
2、方法二:
使用nvm将node修改为不高于16的版本文章来源地址https://www.toymoban.com/news/detail-799588.html
到了这里,关于【npm run serve报错问题node.js版本太高】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!