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?

More than 1 year has passed since last update.

Nuxt Bridge でDo you want to install nuxi package?と聞かれる

Last updated at Posted at 2023-10-29

目次

1.背景
2. nuxiとは
3. installするべきか
3.1 結論
3.2 経緯

1. 背景

nuxt bridge導入中に以下のようにnuxiをinstallしますか?と聞かれた為

ℹ Discovered Components: .nuxt/components/readme.md                                             17:34:17
✔ Builder initialized                                                                           17:34:17
✔ Nuxt files generated                                                                          17:34:17
ℹ Vite warmed up in 3ms                                                                         17:34:17
✔ Nitro built in 298 ms                                                                   nitro 17:34:17
ℹ Waiting for file changes                                                                      17:34:17
ℹ Memory usage: 127 MB (RSS: 248 MB)                                                            17:34:17
ℹ Listening on: http://localhost:3000/                                                          17:34:17
↻ Updated nuxt.config.ts                                                                         17:36:36
ENV_NAME local                                                                                   17:36:36
ℹ Package nuxi is missing                                                                       17:36:36

✔ Do you want to install nuxi package?

2. nuxiとは

Nuxt用の新しく作られたCLIです。

3. installするべきか

3.1 結論

するべきです

3.2 経緯

Do you want to install nuxi package?と毎回聞かれるのを回避する

✔ Do you want to install nuxi package?
No

[17:37:02]  WARN  Failed to install nuxi, please install it manually, or change the nitro option to false in nuxt.config

以下のようにnitro:falseの設定を追加したら聞かれなくなります。

nuxt.config.ts
export default defineNuxtConfig({
  bridge: {
    vite: true,
    typescript: true,
    nitro:false
  },

この後以下のエラーが出ました。

 ERROR  Cannot read properties of undefined (reading 'replace')                                  18:19:13

  at buildClient (node_modules/@nuxt/bridge/dist/chunks/vite.mjs:318:71)
  at bundle (node_modules/@nuxt/bridge/dist/chunks/vite.mjs:750:9)
  at async Builder.build (node_modules/@nuxt/builder/dist/builder.js:249:5)
  at async Object._buildDev (node_modules/@nuxt/cli/dist/cli-dev.js:79:5)
  at async Object.startDev (node_modules/@nuxt/cli/dist/cli-dev.js:55:7)
  at async Object.run (node_modules/@nuxt/cli/dist/cli-dev.js:44:5)
  at async NuxtCommand.run (node_modules/@nuxt/cli/dist/cli-index.js:356:7)

こちらを調べると

nitroをtrueにしないといけないとのことでした。

以下のようにしたら先ほどのエラーは出なくなりました。
しかし、またDo you want to install nuxi package?と聞かれます。

nuxt.config.ts
export default defineNuxtConfig({
  bridge: {
    vite: true,
    typescript: true,
    nitro:true
  },

先ほどのgithubのissueに以下の記述がありました。

viteオプションはnitroに依存するので、vite: trueの場合はnitro: trueでnuxiコマンドを使わなければならない

つまりnuxiをinstallしないといけないことになります。

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?