Build failed: Unknown keyword formatMinimum

See original GitHub issue

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I’m using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

It’s more like a runtime-related issue, so I didn’t create a repro.

We set up a website in https://github.com/datafuselabs/databend/tree/main/website/databend, and developers with Mac M1 failed to build this site.

Reported in https://github.com/datafuselabs/databend/issues/3283

Steps to reproduce

  • Using a macbook pro M1
  • git clone git@github.com:datafuselabs/databend.git
  • cd databend/website/databend
  • npm run build

Expected behavior

The site built successful.

Actual behavior

[en] Creating an optimized production build...

✖ Client
  Compiled with some errors in 9.84s

● Server █████████████████████████ building (64%) 1/1 entries 2234/2234 dependencies 770/770 modules 0 active 
 



Error: Unknown keyword formatMinimum
Module build failed: Error: Unknown keyword formatMinimum
Client bundle compiled with errors therefore further build is impossible.

Your environment

Reproducible demo

https://github.com/datafuselabs/databend/tree/main/website/databend

Self-service

  • I’d be willing to fix this bug myself.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

11reactions
Josh-Cenacommented, Dec 9, 2021

@zhang2014 After inspecting the error stack you posted in the original issue, I think the issue could be a version mismatch between ajv-keywords.

joshcena@Sidas-MacAir:databend$ node -e "require('/Users/joshcena/Desktop/work/Tech/projects/databend/website/databend/node_modules/css-minimizer-webpack-plugin/node_modules/ajv-keywords/dist/index.js').get('formatMinimum')"
/Users/joshcena/Desktop/work/Tech/projects/databend/website/databend/node_modules/css-minimizer-webpack-plugin/node_modules/ajv-keywords/dist/index.js:25
        throw new Error("Unknown keyword " + keyword);
        ^

Error: Unknown keyword formatMinimum
    at Function.get (/Users/joshcena/Desktop/work/Tech/projects/databend/website/databend/node_modules/css-minimizer-webpack-plugin/node_modules/ajv-keywords/dist/index.js:25:15)

The error is coming from the Webpack loader url-loader, which depends on schema-utils@3.1.1, and the latter uses ajv-keywords@3.5.2. The formatMinimum keyword was removed from this package in v4: https://github.com/ajv-validator/ajv-keywords/releases/tag/v4.0.0. Typically, that shouldn’t be an issue, because the right version should be supplied by the package manager; however, in your case, NPM seems to be aggressively flattening the dependency tree and causes a wrong version (ajv-keywords@5.1.0) to be used instead.

I was wrong when I said Yarn wasn’t the issue; Yarn was exactly the reason why I couldn’t reproduce. This incident has demonstrated why Yarn is a better package manager 😄 Please test again with Yarn and check if that works.

1reaction
Josh-Cenacommented, Dec 9, 2021

Hi, two of the maintainers are using Mac M1 (including me). Unfortunately I’m unable to reproduce the issue:

joshcena@Sidas-MacAir:databend$ node --version
v17.1.0
joshcena@Sidas-MacAir:databend$ yarn build
yarn run v1.22.10
$ docusaurus build

[en] Creating an optimized production build...

✔ Client
  

✔ Server
  Compiled successfully in 14.84s


Success! Generated static files in "build".

Use `npm run serve` command to test your build locally.

✨  Done in 19.78s.

(I’m using Yarn because I’m having troubles connecting to the NPM registry but the package manager shouldn’t be the issue here)

Update. I’m on MacOS Big Sur, but there’s little reason why that’s the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 13 upgrade - Error: Unknown keyword formatMinimum
After the upgrade, I ran into an error when I tried to build the project. Error: Module build failed(from ./node_modules/mini ...
Read more >
ajv@7.2.4 - Error: strict mode: unknown keyword
I expect the ajv keyword a unevaluatedProperties to be defined and working in ajv version 7.2.4, however I get the error message in...
Read more >
@rijx/ajv - npm Package Health Analysis | Snyk
The option unknownFormats allows changing the default behaviour when an unknown format is encountered. In this case Ajv can either fail schema compilation ......
Read more >
node_modules/ajv-keywords · master - PLMlab
If the data is not a string, the validation succeeds. The value of keyword formatMaximum ( formatMinimum ) should be a string. This...
Read more >
ajv-formats - Ajv JSON schema validator
These keywords apply only to strings. If the data is not a string, the validation succeeds. The value of keywords formatMaximum / formatMinimum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found