Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failed: Unknown keyword formatMinimum #6073

Closed
5 of 7 tasks
Xuanwo opened this issue Dec 9, 2021 · 6 comments
Closed
5 of 7 tasks

Build failed: Unknown keyword formatMinimum #6073

Xuanwo opened this issue Dec 9, 2021 · 6 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.

Comments

@Xuanwo
Copy link

Xuanwo commented Dec 9, 2021

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 databendlabs/databend#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.
@Xuanwo Xuanwo added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Dec 9, 2021
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented 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

@Josh-Cena Josh-Cena added status: needs more information There is not enough information to take action on the issue. and removed status: needs triage This issue has not been triaged by maintainers labels Dec 9, 2021
@Xuanwo
Copy link
Author

Xuanwo commented Dec 9, 2021

Oh, wired. Let's give it a try.

@zhang2014, can you use node v17.1 and yarn to run yarn run build for a test?

@Josh-Cena Josh-Cena changed the title Can't build on Mac Pro M1 for Unknown keyword formatMinimum Build failed: Unknown keyword formatMinimum Dec 9, 2021
@Josh-Cena
Copy link
Collaborator

Josh-Cena commented 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 :D Please test again with Yarn and check if that works.

@Josh-Cena Josh-Cena added external This issue is caused by an external dependency and not Docusaurus. and removed status: needs more information There is not enough information to take action on the issue. labels Dec 9, 2021
@Xuanwo
Copy link
Author

Xuanwo commented Dec 9, 2021

@Josh-Cena Thank you so much for your quick and accurate feedback, it's awesome!

@Xuanwo Xuanwo moved this to 📦 Done in Xuanwo's Work Dec 9, 2021
@gorgos
Copy link

gorgos commented Feb 5, 2022

For anyone from Google, I just updated Npm to the latest version and it fixed the issue.

@KishanKumarNR
Copy link

KishanKumarNR commented Mar 6, 2024

Just moved those "ajv" from dependencies to devDependencies

"devDependencies": { "ajv": "^8.12.0", "ajv-keywords": "^5.1.0", }

It works like a charm with npm itself.

{ npm: '7.23.0', node: '14.15.0', }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution external This issue is caused by an external dependency and not Docusaurus.
Projects
None yet
Development

No branches or pull requests

4 participants