Help us understand the problem. What is going on with this article?

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

More than 1 year has passed since last update.

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      │
   │                                             │
   ╰─────────────────────────────────────────────╯
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした