Page MenuHomePhabricator

Update Node in Fresh to at least v14.18
Closed, ResolvedPublic

Description

Currently, Fresh ships Node v14.17.5, but the Vite build system requires Node v14.18 or higher since Vite 3 (relevant commit). It would be great to have a Node version in Fresh that supports the latest Vite.

Details

Related Changes in Gerrit:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

And yes, Vite really needs the newer Node version, we can’t just ignore the npm install warning I’m afraid:

$ FRESH_INTERNAL_RUNCMD='npx vite' fresh-node -net
# fresh: 22.05.1
# image: docker-registry.wikimedia.org/releng/node14-test-browser:0.0.2-s4
# software: Debian GNU/Linux 11 (bullseye)
#           Node.js v14.17.5 (npm 7.21.0)
#           Chromium 97.0.4692.99
#           Mozilla Firefox 91.5.0esr
#           JSDuck 5.3.4 (Ruby 2.7.4) ruby 2.7.4p191
# mount: /new-lexeme      ➟ /var/www/html/wiki1/extensions/WikibaseLexeme/resources/special/new-lexeme      (read-write)
#        /new-lexeme/.git ➟ /var/www/html/wiki1/extensions/WikibaseLexeme/resources/special/new-lexeme/.git (read-only)
# net: expose host

🌱  Fresh!

failed to load config from /new-lexeme/vite.config.ts
error when starting dev server:
Error: Cannot find module 'node:path'
Require stack:
- /new-lexeme/node_modules/vite/dist/node-cjs/publicUtils.cjs
- /new-lexeme/node_modules/vite/index.cjs
- /new-lexeme/vite.config.ts
- /new-lexeme/node_modules/vite/dist/node/chunks/dep-c6273c7a.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/new-lexeme/node_modules/vite/dist/node-cjs/publicUtils.cjs:5:14)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Object._require.extensions.<computed> [as .js] (file:///new-lexeme/node_modules/vite/dist/node/chunks/dep-c6273c7a.js:62892:17)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
Krinkle renamed this task from Update Node to at least v14.18 to Update Node in Fresh to at least v14.18.Aug 1 2022, 6:58 PM

@LucasWerkmeister Can you confirm whether this is an issue in CI as well, or only in Fresh? Fresh is a small shell script that essentially just runs docker run … with the latest docker image for WMF CI nodejs jobs, plus some convenience for directory mounting and passing env/network information.

If Node.js in CI is already updated, then we probably just need to bump our docker image reference. Otherwise you may have to resolve this in CI first, and Fresh follows.

Change 819197 had a related patch set uploaded (by Jforrester; author: Jforrester):

[fresh@master] [WIP] Provide fresh-node16

https://gerrit.wikimedia.org/r/819197

I've confirmed that v14.7.5 is what the latest CI image uses:

&& curl -Lo node-${NODE_VERSION}.tar.gz https://nodejs.org/dist/v14.17.5/node-${NODE_VERSION}.tar.gz \

Having said that, v14.8.0 was actually fairly early on in upstream's release cycle. It was a minor release before it went into maintenance mode, and thus before 15.0 and 16.0, which means any 16.0.0 version should work for you, and thus T314347: Add Fresh support for Node.js 16 LTS might be a more worthwhile solution instead of asking RelEng to do another round of updates for Node 14.

@LucasWerkmeister Can you confirm whether this is an issue in CI as well, or only in Fresh? Fresh is a small shell script that essentially just runs docker run … with the latest docker image for WMF CI nodejs jobs, plus some convenience for directory mounting and passing env/network information.

If Node.js in CI is already updated, then we probably just need to bump our docker image reference. Otherwise you may have to resolve this in CI first, and Fresh follows.

It would probably be an issue in CI as well, but we noticed this in a project that doesn’t use Wikimedia CI. The only projects using Vite in codesearch are Codex and ContentTranslation, both still on Vite 2 at the moment; they’d probably run into the issue once they tried to upgrade to Vite.

Having Node 16 also sounds like a fine solution to me :)

Correction: we do run our build step in Wikimedia CI (when checking that the committed build results in WikibaseLexeme.git match the git submodule) – failed example build. So yeah, for now I think we need to downgrade Vite, and then get either Node ^14.18 or Node 16 in CI.

Change 819197 merged by jenkins-bot:

[fresh@master] Add fresh-node16

https://gerrit.wikimedia.org/r/819197