typescript 尝试编译节点中的Angular 应用程序时出错

relj7zay  于 2023-02-25  发布在  TypeScript
关注(0)|答案(2)|浏览(184)

这是当我尝试运行ng serve --open for my app时发生的错误,它还显示error while ng --version to check version它显示节点17不支持此Angular ,但当我尝试运行另一个可以工作但我下载的应用时不支持。

/ Generating browser application bundles (phase: building)...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:\Training\Angular\mCart\node_modules\webpack\lib\util\createHash.js:145:18)
    at BulkUpdateDecorator.update (D:\Training\Angular\mCart\node_modules\webpack\lib\util\createHash.js:46:50)
    at RawSource.updateHash (D:\Training\Angular\mCart\node_modules\webpack\node_modules\webpack-sources\lib\RawSource.js:77:8)
    at NormalModule._initBuildHash (D:\Training\Angular\mCart\node_modules\webpack\lib\NormalModule.js:880:17)
    at handleParseResult (D:\Training\Angular\mCart\node_modules\webpack\lib\NormalModule.js:946:10)
    at D:\Training\Angular\mCart\node_modules\webpack\lib\NormalModule.js:1040:4
    at processResult (D:\Training\Angular\mCart\node_modules\webpack\lib\NormalModule.js:755:11)
    at D:\Training\Angular\mCart\node_modules\webpack\lib\NormalModule.js:819:5 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
jmo0nnb3

jmo0nnb31#

您可能正在运行最新版本的Node,Angular尚未正式支持该版本。https://angular.io/guide/setup-local#prerequisites
安装LTS版本的节点,然后重试=〉https://nodejs.org/en/download/

hgc7kmma

hgc7kmma2#

这是节点最新版本的支持问题,我也面临着同样的问题,我从我的系统卸载了版本,并从官方节点网站下载了降级版本
https://nodejs.org/en/download/releases/
我安装了Node.js 16.19.1,并且能够运行ng服务

相关问题