InBrowserApp / tldr.inbrowser.app

📝 tldr InBrowser.App is a offline-capable PWA for tldr-pages. Fully runs in your browser. Zero API latency.
https://tldr.inbrowser.app
MIT License
185 stars 21 forks source link

getText.ts error TS2722: Cannot invoke an object which is possibly 'undefined' #21

Closed langfingaz closed 5 months ago

langfingaz commented 6 months ago

Hi there!

Many thanks for developing this project. I've written a Dockerfile to create a container image and self-host the web application.

Since some changes to the Git repository, I get the following type-check error while running npm run download:tldr-pages && npm run build:sitemap && run-p type-check build-only:

src/data/tldr-pages/page/zip/zipLib/getText.ts(5,22): error TS2722: Cannot invoke an object which is possibly 'undefined'

Here is the relevant log from docker build ... (Dockerfile):

 => [builder 4/5] RUN npm install --progress                                                                                                                                  61.0s
 => ERROR [builder 5/5] RUN npm run build                                                                                                                                     14.9s
------
 > [builder 5/5] RUN npm run build:
0.724 
0.724 > tldr.inbrowser.app@0.0.0 build
0.724 > npm run download:tldr-pages && npm run build:sitemap && run-p type-check build-only
0.724 
0.942 
0.942 > tldr.inbrowser.app@0.0.0 download:tldr-pages
0.942 > wget -O public/tldr-pages.zip https://github.com/tldr-pages/tldr/archive/refs/heads/main.zip
0.942 
0.968 Connecting to github.com (140.82.121.4:443)
1.247 Connecting to codeload.github.com (140.82.121.9:443)
1.450 saving to 'public/tldr-pages.zip'
2.209 tldr-pages.zip        47% |***************                 | 3379k  0:00:01 ETA
2.881 tldr-pages.zip       100% |********************************| 7138k  0:00:00 ETA
2.881 'public/tldr-pages.zip' saved
3.108 
3.108 > tldr.inbrowser.app@0.0.0 build:sitemap
3.108 > node scripts/build-sitemap.js
3.108 
3.414 Sitemap page urls count: 15933
3.417 Writing sitemap.xml
3.781 
3.781 > tldr.inbrowser.app@0.0.0 type-check
3.781 > vue-tsc --noEmit -p tsconfig.vitest.json --composite false
3.781 
3.783 
3.783 > tldr.inbrowser.app@0.0.0 build-only
3.783 > vite build
3.783 
4.288 vite v4.5.2 building for production...
4.351 transforming...
14.72 src/data/tldr-pages/page/zip/zipLib/getText.ts(5,22): error TS2722: Cannot invoke an object which is possibly 'undefined'.
14.85 ERROR: "type-check" exited with 2.
------
Dockerfile:15
--------------------
  13 |     RUN npm install --progress
  14 |     # Build to ./dist/
  15 | >>> RUN npm run build
  16 |     
  17 |     FROM nginx:alpine as webserver
--------------------

If this is too far off topic and your builds work, please don't put too much effort into this issue. But I thought that maybe this points you to some relevant error/bug in the code.

rwv commented 6 months ago

try use pnpm