Saturday, July 20, 2024

Continued from Wednesday, July 17, 2024.

Here is my current problem when I try to run npm run build:

(dev) luc@yoga:~/work/react$ npm run build

> lino_react@24.5.0 build
> NODE_OPTIONS='--max-old-space-size=8192' webpack --mode production

assets by status 3.82 MiB [cached] 50 assets
Entrypoint main = main.runtime.430b48360e2c8f3437a2.js main.30cfd4b61f5cb674be23.js 2 auxiliary assets
orphan modules 438 KiB [orphan] 58 modules
runtime modules 12.1 KiB 14 modules
modules by path ./node_modules/ 4.48 MiB (javascript) 241 KiB (asset)
  javascript modules 4.48 MiB 165 modules
  asset modules 210 bytes (javascript) 241 KiB (asset)
    ./node_modules/primeicons/fonts/primeicons.eot 42 bytes (javascript) 70.7 KiB (asset) [built] [code generated]
    ./node_modules/primeicons/fonts/primeicons.woff2 42 bytes (javascript) 29.5 KiB (asset) [built] [code generated]
    + 3 modules
modules by path ./lino_react/react/ 494 KiB 38 modules
modules by mime type image/png 357 bytes
  data:image/png;base64,iVBORw0KGgoAAAAN.. 179 bytes [built] [code generated]
  data:image/png;base64,iVBORw0KGgoAAAAN.. 178 bytes [built] [code generated]

LOG from InjectManifest
<i> The service worker at ../../config/react/service-worker.js will precache
<i>         0 URLs, totaling 0 B.

ERROR in ./lino_react/react/components/App.jsx 11:7-72
Module not found: Error: Can't resolve 'react-dom/client' in '/home/luc/work/react/lino_react/react/components'
Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".tsx",".js",".json",".html",".ts",".jsx",".css",".mjs",".bmp",".gif",".jpg",".jpeg",".png",".woff",".woff2",".eot",".ttf",".otf"]' instead of '[".tsx",".js",".json",".html",".ts",".jsx",".css",".mjs",".bmp",".gif",".jpg",".jpeg",".png","woff","woff2","eot","ttf","otf"]'?
 @ ./lino_react/react/index.js 1:0-42 2:0-6

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
7:7-17
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(7,8)
      TS2339: Property 'SERVER_URL' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
8:7-19
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(8,8)
      TS2339: Property 'WAIT_TIMEOUT' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
10:7-17
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(10,8)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
12:44-56
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(12,45)
      TS2339: Property 'WAIT_TIMEOUT' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
21:7-11
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(21,8)
      TS2339: Property 'wait' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
23:21-31
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(23,22)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
29:21-25
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(29,22)
      TS2339: Property 'wait' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
30:21-31
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(30,22)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
35:7-13
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(35,8)
      TS2339: Property 'signIn' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
36:17-21
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(36,18)
      TS2339: Property 'wait' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
38:17-27
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(38,18)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
54:17-27
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(54,18)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts
61:17-21
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/setupTests.ts(61,18)
      TS2339: Property 'wait' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts
14:31-41
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts(14,32)
      TS2339: Property 'SERVER_URL' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts
15:21-27
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts(15,22)
      TS2339: Property 'signIn' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts
19:21-25
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts(19,22)
      TS2339: Property 'wait' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts
20:21-31
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts(20,22)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts
35:21-31
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/cloneUI.ts(35,22)
      TS2339: Property 'waitToMeet' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts
14:31-41
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts(14,32)
      TS2339: Property 'SERVER_URL' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts
18:31-41
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts(18,32)
      TS2339: Property 'SERVER_URL' does not exist on type 'Global & typeof globalThis'.

ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts
19:21-27
[tsl] ERROR in /home/luc/work/react/lino_react/react/components/__tests__/integrity.ts(19,22)
      TS2339: Property 'signIn' does not exist on type 'Global & typeof globalThis'.

22 errors have detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.

webpack 5.93.0 compiled with 22 errors in 15425 ms

The message “Did you mean ‘[“.tsx”,”.js”,”.json”,”.html”,”.ts”,”.jsx”,”.css”,”.mjs”,”.bmp”,”.gif”,”.jpg”,”.jpeg”,”.png”,”.woff”,”.woff2”,”.eot”,”.ttf”,”.otf”]’ instead of ‘[“.tsx”,”.js”,”.json”,”.html”,”.ts”,”.jsx”,”.css”,”.mjs”,”.bmp”,”.gif”,”.jpg”,”.jpeg”,”.png”,”woff”,”woff2”,”eot”,”ttf”,”otf”]’?” made me change the webpack.config.js file where indeed the last five extensions didn’t start with a dot. Seems that this was just an irrelevant warning.

The packages.json talks much about “electron”. What’s that? Google gave me https://www.electron.build/ and I tried to install it:

yarn add electron-builder --dev

Lots of output, here are some chunks:

! Corepack is about to download https://registry.yarnpkg.com/yarn/-/yarn-1.22.22.tgz
? Do you want to continue? [Y/n] Y

! The local project doesn't define a 'packageManager' field. Corepack will now add one referencing yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e.
! For more details about this field, consult the documentation at https://nodejs.org/api/packages.html#packagemanager

yarn add v1.22.22
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
...

[3/4] Linking dependencies...
warning " > autoprefixer@10.4.19" has unmet peer dependency "postcss@^8.1.0".
warning " > ts-node@10.9.2" has unmet peer dependency "@types/node@*".
warning "electron-builder > app-builder-lib@24.13.3" has unmet peer dependency "electron-builder-squirrel-windows@24.13.3".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 885 new dependencies.
info Direct dependencies
├─ @babel/cli@7.24.8
├─ @babel/core@7.24.9
├─ @babel/plugin-transform-runtime@7.24.7
...

├─ yauzl@2.10.0
├─ yn@3.1.1
└─ yocto-queue@0.1.0
Done in 152.53s.

The warning “The local project doesn’t define a ‘packageManager’ field. Corepack will now add one…” makes me think that this is probably not the right way. If Sharif had been using electron builder, the packageManager field would already exist. So I removed that field again.

I tried “npm audit fix”:

$ npm audit fix

up to date, audited 1831 packages in 2s

215 packages are looking for funding
  run `npm fund` for details

# npm audit report

babel-traverse  *
Severity: critical
Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code - https://github.com/advisories/GHSA-67hx-6x53-jw92
fix available via `npm audit fix --force`
Will install babel-plugin-transform-class-properties@6.10.2, which is a breaking change
node_modules/babel-traverse
  babel-helper-function-name  *
  Depends on vulnerable versions of babel-template
  Depends on vulnerable versions of babel-traverse
  node_modules/babel-helper-function-name
    babel-plugin-transform-class-properties  >=6.11.5
    Depends on vulnerable versions of babel-helper-function-name
    Depends on vulnerable versions of babel-template
    node_modules/babel-plugin-transform-class-properties
  babel-template  *
  Depends on vulnerable versions of babel-traverse
  node_modules/babel-template

json5  <1.0.2
Severity: high
Prototype Pollution in JSON5 via Parse Method - https://github.com/advisories/GHSA-9c47-m6qq-7p4h
fix available via `npm audit fix --force`
Will install webpack-typescript@0.5.5, which is a breaking change
node_modules/loader-utils/node_modules/json5
  loader-utils  <=1.4.0
  Depends on vulnerable versions of json5
  node_modules/loader-utils
    webpack-typescript  >=0.5.6
    Depends on vulnerable versions of loader-utils
    node_modules/webpack-typescript


quill  <=1.3.7
Severity: moderate
Cross-site Scripting in quill - https://github.com/advisories/GHSA-4943-9vgg-gr5r
fix available via `npm audit fix --force`
Will install quill@2.0.2, which is a breaking change
node_modules/quill
  quill-mention  <=4.1.0
  Depends on vulnerable versions of quill
  node_modules/quill-mention

ws  8.0.0 - 8.17.0
Severity: high
ws affected by a DoS when handling a request with many HTTP headers - https://github.com/advisories/GHSA-3h5v-q93c-6h6q
fix available via `npm audit fix --force`
Will install puppeteer@22.13.1, which is a breaking change
node_modules/puppeteer-core/node_modules/ws
  puppeteer-core  11.0.0 - 22.11.1
  Depends on vulnerable versions of ws
  node_modules/puppeteer-core
    puppeteer  18.2.0 - 22.11.1
    Depends on vulnerable versions of puppeteer-core
    node_modules/puppeteer

12 vulnerabilities (2 moderate, 4 high, 6 critical)

To address all issues (including breaking changes), run:
  npm audit fix --force

I ran “npm audit fix –force” several times, the first time it gave a lot of output similar to above, but after two or three runs it got kind of satisfied:

$ npm audit fix --force
npm warn using --force Recommended protections disabled.
npm warn audit Updating babel-plugin-transform-class-properties to 6.10.2, which is a SemVer major change.

removed 20 packages, changed 2 packages, and audited 1796 packages in 3s

215 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ npm audit fix --force
npm warn using --force Recommended protections disabled.

up to date, audited 1796 packages in 2s

215 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

I wondered whether it is maybe actually working. The only errors are in lino_react/react/components/setupTests.ts, it’s possible that that they aren’t important. Sharif started to experiment with testing frameworks only recently.

But no. Because the files under :file: lino_react/react/static haven’t changed. I also made a minor change to one source file and (LinoToolbar.jsx), ran npm run build again: still no change in the static directory. So it’s sure that I need to also get rid of the remaining error messages.

The story continues on Monday, July 29, 2024.