18
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Node.jsのバージョンがv17の場合、Vue.jsプロジェクト起動時に'ERR_OSSL_EVP_UNSUPPORTED'エラーが出る

Last updated at Posted at 2021-12-20

環境

  • Node.js: v17.2.0
  • Vue.js: 3.5.0
  • OpenSSL: 1.1.1
  • WSL2(Ubuntu-20,04)

発生したエラー

Vue.jsプロジェクト起動後、ERR_OSSL_EVP_UNSUPPORTEDエラーが発生した

$ npm run serve
> sample-app@0.1.0 serve
> vue-cli-service serve

 INFO  Starting development server...
10% building 2/4 modules 2 active .../webpack-dev-server/client/index.js?http://172.22.69.55:8080&sockPath=/sockjs-nodeError: error:0308010C:digital envelope routines::unsupported
   (省略)
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
   (省略)
    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 17はOpenSSL 3.0を利用している。
  • OpenSSL 3.0では、OpenSSL 1.1.1で利用できた鍵やアルゴリズムがデフォルトで一部制限されている。
  • そのため、Node.js 17では、OpenSSL 3.0で許可されていない鍵やアルゴリズムを利用したアプリケーションやモジュールを利用しようとするとERR_OSSL_EVP_UNSUPPORTEDエラーが出るみたいです。

While OpenSSL 3.0 APIs should be mostly compatible with those provided by OpenSSL 1.1.1, we do anticipate some ecosystem impact due to tightened restrictions on the allowed algorithms and key sizes.
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.

解決法

  • 公式にある通りに下位互換の環境設定が必要とのこと。以下設定後、無事起動できました。
export NODE_OPTIONS=--openssl-legacy-provider

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.

参考

18
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?