4
2

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 3 years have passed since last update.

エラー文 Error: Cannot find module 'vuetify/es5/util/colors' の解決法

Last updated at Posted at 2020-10-15

npm run devをしたところ、次のエラーが表示される。

sahota0701nemoto@S box % npm run dev

> box@1.0.0 dev /Users/shogo/environment/box
> nuxt


 FATAL  Cannot find module 'vuetify/es5/util/colors'                                                                                                                                              12:40:22
Require stack:
- /Users/shogo/environment/box/nuxt.config.js
- /Users/shogo/environment/box/node_modules/@nuxt/config/dist/config.js
- /Users/shogo/environment/box/node_modules/@nuxt/cli/dist/cli-index.js
- /Users/shogo/environment/box/node_modules/@nuxt/cli/dist/cli.js
- /Users/shogo/environment/box/node_modules/nuxt/bin/nuxt.js

  Error: Cannot find module 'vuetify/es5/util/colors'
  Require stack:
  - nuxt.config.js
  - node_modules/@nuxt/config/dist/config.js
  - node_modules/@nuxt/cli/dist/cli-index.js
  - node_modules/@nuxt/cli/dist/cli.js
  - node_modules/nuxt/bin/nuxt.js
  at Object.<anonymous> (nuxt.config.js:1)


   ╭─────────────────────────────────────────────────────────────────────────────╮
   │                                                                             │
   │   ✖ Nuxt Fatal Error                                                        │
   │                                                                             │
   │   Error: Cannot find module 'vuetify/es5/util/colors'                       │
   │   Require stack:                                                            │
   │   - /Users/shogo/environment/box/nuxt.config.js                             │
   │   - /Users/shogo/environment/box/node_modules/@nuxt/config/dist/config.js   │
   │   - /Users/shogo/environment/box/node_modules/@nuxt/cli/dist/cli-index.js   │
   │   - /Users/shogo/environment/box/node_modules/@nuxt/cli/dist/cli.js         │
   │   - /Users/shogo/environment/box/node_modules/nuxt/bin/nuxt.js              │
   │                                                                             │
   ╰─────────────────────────────────────────────────────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! box@1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the box@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/shogo/.npm/_logs/2020-10-15T03_40_22_189Z-debug.log

npm run devをすると下記のエラー。

> box@1.0.0 dev /Users/shogo/environment/hoge
> nuxt

sh: nuxt: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! box@1.0.0 dev: `nuxt`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the box@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

原因:modulesの中にvuetifyがない。

下記の順番で確認してください。
・vuetifyがインストールがちゃんとできているか確認。
・node_modulesの中にvuetifyがあるか確認
・vuetify/es5/~~~のパス通りにファイルがあるか確認
・参考サイトのvuetifyと今使ってるvuetifyのバージョンの相違ないか確認
・相違なければvuetifyをアンインストール、再インストール
・それでもだめならvuetifyの最新版をインストール

解決法:vue add vuetifyコマンド

下記コマンドでvuetifyをインストールすれば動くようになる。

$  vue add vuetify

余談
node_modulesの中身には、package.json内に書かれているものがインストールされる。

他に解決法がありましたらコメントください。

4
2
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
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?