allenai / pawls

Software that makes labeling PDFs easy.
https://pawls.apps.allenai.org
Apache License 2.0
390 stars 74 forks source link

Running with Node 10.24.1 #123

Closed eliotpbrenner closed 3 years ago

eliotpbrenner commented 3 years ago

The earliest Node 10.x.y I can run the UI with is 10.24.1, because of security vulnerabilities in the version of node in the current Dockerfile.

When I run with the version of typescript in the current package.json for the ui, I get typescript errors. ("=" expected TS1005 on AntdIcon.d.ts, line 2 "import type..."). When I run with typescript 4.2.4 (changing the version in the ui/package.json) I get syntax error "Cannot read property 'map' of undefined' on ./src/pages/PDFPage.tsx.

Is there a version of typescript which will run the code with Node 10.24.1? Or is it necessary to change to PAWLS code?

codeviking commented 3 years ago

Sorry about that. Node v10 won't be maintained as of 4/30, so this is a good reminder to update. I'll see if I can get things working with Node 14 today.

Best, Sam

eliotpbrenner commented 3 years ago

Thanks, I just went ahead and updated the Node dependency in the Dockerfile to 14, as you've done here. But I run into another error now:

Typescript error in /usr/local/src/skiff/app/ui/src/components/PDF.tsx(3,10):
Module '"../../node_modules/pdfjs-dist/types/pdf"' has no exported member 'PDFPageProxy'.  TS2305

...
3 | import {PDFPageProxy, PDFRenderTask } from 'pdfjs-dist';
...

It seems like there's some conflict between the dependencies @types/pdfjs-dist, which is currently set to "^2.1.5" and pdfjs-dist, which is currently set to "^2.4.456". I haven't been able to find a combination that works, yet.

codeviking commented 3 years ago

That's odd. I can't reproduce that error.

Are there other dependencies that you've modified?

eliotpbrenner commented 3 years ago

Yes, I had to change typescript to 3.8. If I use typescript 3.6.3 as in the repo I get an TypeScript error on AntdIcon.d.ts. '=' expected. TS1005 on

"import type { IconDefinition } from '@ant-design/icons-svg/lib/types';"

searching around I found that the suggested solution was to upgrade typescript to at least 3.8. This eliminated this error but introduced the one above.

codeviking commented 3 years ago

Gotcha. In rereading your original message I see you said all of that. Sorry to make your repeat it.

I'll get the TypeScript updated shortly too. I imagine I'll run into the same error, and can hopefully get it fixed up!

codeviking commented 3 years ago

Ok @eliotpbrenner. I updated a few things in https://github.com/allenai/pawls/commit/0f3e5153241502eb68e46f582ed4b28112e2f765. I think this should take care of the problems you're running into (I was able to reproduce them).

Ultimately there were some other dependencies that needed to be updated along with TypeScript. Specifically eslint and pdfjs.

Thanks for reporting the issue as it prompted a dependency update that was overdue!