问题记录 今天把一个以前的古早项目拖出来,准备跑起来改一改。

安装npm包

yarn i - D

运行

yarn run serve

一番操作下来,如行云流水。结果报错了:

opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ], library: ‘digital envelope routines’, reason: ‘unsupported’, code: ‘ERR_OSSL_EVP_UNSUPPORTED’

只好求助万能的百度(谷歌),关键词“ERR_OSSL_EVP_UNSUPPORTED”,最终得到如下结论:

If you hit an ERR_OSSL_EVP_UNSUPPORTED error in your application with Node.js 17, it’s likely that your application or a module you’re using is attempting to use an algorithm or key size which is no longer allowed by default with OpenSSL 3.0. A new command-line option, –openssl-legacy-provider, has been added to revert to the legacy provider as a temporary workaround for these tightened restrictions.

添加node运行选项 –openssl-legacy-provider,可以解决这个报错的问题。

问题解决 问题的原因和解决方法都有了,剩下的就是实际操作了。

打开node_modules/.bin,找到构建工具的启动命令,在node的后面加上启动参数,然后保存。

node –openssl-legacy-provider “\(basedir/../@vue/cli-service/bin/vue-cli-service.js" "\)@”

也可以选择修改环境变量来设置node的option:

NODE_OPTIONS=“–openssl-legacy-provider”

yarn run serve,正常运行,大功告成!

阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。