0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Node16 + Nuxt2で@nuxtjs/i18nをインストールするとエラーが発生した

Posted at

前提

  • Node:16.13.2
  • Nuxt.js:2.15.8
  • Vue.js:2.7.10
  • yarn:1.22.15

エラーについて

下記のようにインストールしようとしたところエラーが発生しました。

$ yarn add @nuxtjs/i18n
yarn add v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
error globby@14.0.1: The engine "node" is incompatible with this module. Expected version ">=18". Got "16.13.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

globby@14.0.1というパッケージがNode18以上でないといけないようです。ちなみに何回かコマンドを実行していると下記のようにエラー文が変わり@intlify/h3@0.5.0がNode18以上でないといけないと表示されることもあります。

$ yarn add @nuxtjs/i18n
yarn add v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
error @intlify/h3@0.5.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.13.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

解決方法

Node16では@nuxtjs/i18nの新しいバージョンが使えなそうなので、バージョンを指定してインストールしてみました。

$ yarn add @nuxtjs/i18n@7.3
yarn add v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "nuxt > @nuxt/components@2.2.1" has unmet peer dependency "consola@*".
warning "@nuxtjs/vuetify > sass-loader@10.4.1" has unmet peer dependency "webpack@^4.36.0 || ^5.0.0".
warning "@nuxtjs/vuetify > vuetify-loader@1.9.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ @nuxtjs/i18n@7.3.1
info All dependencies
└─ @nuxtjs/i18n@7.3.1
Done in 50.86s.

ちなみにバージョン8を指定するとエラーが発生しました。詳細には調べていないですが、バージョン7系以下が使える感じですかね。

yarn add @nuxtjs/i18n@8
yarn add v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
error @intlify/h3@0.5.0: The engine "node" is incompatible with this module. Expected version ">= 18". Got "16.13.2"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

以上です。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?