Nuxt.js "Enable vuex store by creating store/index.js." エラーの解決方法

Sat, December 19, 2020 - 1 min read

Nuxt.js で Enable vuex store by creating store/index.js. エラーが発生したときの解決方法をご紹介します。

<img src=“https://res.cloudinary.com/codenote-net/images/w_auto:100:582,f_auto,q_auto/v1562591707/Nuxt.js/Nuxt-js-png?_i=AA” class=“alignnone title=“Nuxt.js” alt=“Nuxt.js”>

背景

前提条件 Nuxt.js v2.14.7

  • Nuxt.js version 2.14.7
  • Node.js version 14.15.1

Enable vuex store by creating store/index.js エラー

npm run dev 実行時に以下のエラーが発生したので

Nuxt Fatal Error
Enable vuex store by creating store/index.js.

解決方法 store/index.js を作成する

store/index.js を作成するだけで Enable vuex store by creating store/index.js. エラーを解決できます。

JavaScript の場合 touch store/index.js

touch store/index.js

TypeScript の場合 touch store/index.ts

touch store/index.ts

以上、Nuxt.js Enable vuex store by creating store/index.js. エラーを解決した、現場からお送りしました。