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

Undocumented requirements on Node version for building the site #35825

Closed
fatso83 opened this issue Sep 11, 2024 · 0 comments · Fixed by #35826
Closed

Undocumented requirements on Node version for building the site #35825

fatso83 opened this issue Sep 11, 2024 · 0 comments · Fixed by #35826
Labels
Content:Meta Content in the meta docs

Comments

@fatso83
Copy link
Contributor

fatso83 commented Sep 11, 2024

Currently the docs are not complete, as building the site per the contributor docs does not work in neither Node 20 nor Node 22. I conferred the engines spec and it does not reflect reality:

❯ jq .engines package.json
{
  "node": ">=18.18.0"
}

Stating the working versions and/or having a Github workflow that builds the site using all LTS versions of Node would be a start in fixing this.

Results of building

Node 20.9.0

  npx yarn start
yarn run v1.22.22
$ yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true BUILD_OUT_ROOT=build yar
i-server
$ node scripts/up-to-date-check.js                                                                                           ir current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:80436) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
file:///Users/carlerik/dev/mdn-content/node_modules/compute-baseline/dist/browser-compat-data/compat.js:1
import bcd from "@mdn/browser-compat-data" with { type: "json" };
                                           ^^^^

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:118:18)
    at callTranslator (node:internal/modules/esm/loader:273:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)

Node.js v20.9.0
error Command failed with exit code 1.
Node.js v20.9.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Node 22.8

  npx yarn start
yarn run v1.22.22
$ yarn up-to-date-check && env-cmd --silent cross-env CONTENT_ROOT=files REACT_APP_DISABLE_AUTH=true BUILD_OUT_ROOT=build yar
i-server
$ node scripts/up-to-date-check.js                                                                                           ir current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:80436) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
file:///Users/carlerik/dev/mdn-content/node_modules/compute-baseline/dist/browser-compat-data/compat.js:1
import bcd from "@mdn/browser-compat-data" with { type: "json" };
                                           ^^^^

SyntaxError: Unexpected token 'with'
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:118:18)
    at callTranslator (node:internal/modules/esm/loader:273:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:278:30)

Node.js v20.9.0
error Command failed with exit code 1.
Node.js v20.9.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Some analysis

I see that the assert syntax failing the Node 20 build is deprecated and removed in Node 22, so I can try fixing that script.

@github-actions github-actions bot added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Sep 11, 2024
fatso83 added a commit to fatso83/content that referenced this issue Sep 11, 2024
fatso83 added a commit to fatso83/content that referenced this issue Sep 11, 2024
fatso83 added a commit to fatso83/content that referenced this issue Sep 11, 2024
@Josh-Cena Josh-Cena added Content:Meta Content in the meta docs and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Sep 11, 2024
fiji-flo pushed a commit that referenced this issue Oct 2, 2024
* Remove deprecated 'assert' import syntax in favor of 'with'

fixes #35825

* Set minimum Node version in `.engines` field to 18.20.0

This is the minimum version that supports the new `import ... with`
syntax.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Meta Content in the meta docs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants