LoginSignup
2

More than 5 years have passed since last update.

ERROR custom keyword definition is invalid: data/errors should be boolean

Last updated at Posted at 2019-02-10

1. 概要

Nuxt.js で新規のプロジェクト作成して実行しようとしたら下記のエラーが出ました.

 ERROR  custom keyword definition is invalid: data/errors should be boolean

2. 解決策

下記を実行すれば fix できました.

$ npm uninstall ajv
$ npm install ajv@6.8.1

3. 詳細

プロジェクトを新規作成

$ npx create-nuxt-app sample-003
? Project name sample-003
? Project description My stylish Nuxt.js project
? Use a custom server framework none
? Choose features to install
? Use a custom UI framework none
? Use a custom test framework none
? Choose rendering mode Universal
? Author name Hayato Akatsuka
? Choose a package manager npm

プロジェクト実行すると「 ERROR custom keyword definition is invalid: data/errors should be boolean」と怒られました.

$ cd sample-003
$ npm run dev

 WARN  Address `localhost:3000` is already in use.

ℹ Trying a random port...
 ERROR  custom keyword definition is invalid: data/errors should be boolean

  at Ajv.addKeyword (node_modules/ajv/lib/keyword.js:65:13)
  at module.exports (node_modules/ajv-errors/index.js:10:7)
  at Object.<anonymous> (node_modules/schema-utils/src/validateOptions.js:22:1)
  at Module._compile (internal/modules/cjs/loader.js:678:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
  at Module.load (internal/modules/cjs/loader.js:589:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
  at Function.Module._load (internal/modules/cjs/loader.js:520:3)
  at Module.require (internal/modules/cjs/loader.js:626:17)
  at require (internal/modules/cjs/helpers.js:20:18)

本件については,webpack で issue が作成されていました.

解決方法は ajv を下記の通りアンインストール後にインストールします.

$ npm uninstall ajv
$ npm install ajv@6.8.1

ちゃんと動きました.

$ npm run dev

 WARN  Address `localhost:3000` is already in use.
ℹ Trying a random port...
ℹ Preparing project for development                                                                                                                   ℹ Initial build may take a while                                                                                                                      ✔ Builder initialized                                                                                                                                 ✔ Nuxt files generated
✔ Client
  Compiled successfully in 8.39s
✔ Server
  Compiled successfully in 7.72s
ℹ Waiting for file changes

   ╭─────────────────────────────────────────────╮
   │                                             │
   │   Nuxt.js v2.4.3                            │
   │   Running in development mode (universal)   │
   │   Memory usage: 182 MB (RSS: 261 MB)        │
   │                                             │
   │   Listening on: http://localhost:50482      │
   │                                             │
   ╰─────────────────────────────────────────────╯

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
2