Alcumus/react-doc-viewer

Compile error

Opened this issue · 4 comments

Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory.

Get this when creating the basic example.
to reproduce
npx create-react-app docviewer
overwrite app with the example code

import DocViewer from "react-doc-viewer";

function App() {
const docs = [
// { uri: "https://url-to-my-pdf.pdf" },
{ uri: require("./test.pdf") }, // Local File
];

return ;
}

Add test.pdf to src folder.

npm start

error occurs.
Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory.

I am facing the same issuse, just rendering the component with a single pdf file completely blocks the compile process.
Here is the stacktrace:

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
1: 00007FF797FB401F v8::internal::CodeObjectRegistry::~CodeObjectRegistry+112511
2: 00007FF797F43146 DSA_meth_get_flags+65542
3: 00007FF797F43FFD node::OnFatalError+301
4: 00007FF798875ADE v8::Isolate::ReportExternalAllocationLimitReached+94
5: 00007FF79886000D v8::SharedArrayBuffer::Externalize+781
6: 00007FF7987035FC v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1468
7: 00007FF7987102A9 v8::internal::Heap::PublishPendingAllocations+1129
8: 00007FF79870D27A v8::internal::Heap::PageFlagsAreConsistent+2842
9: 00007FF7986FFEF9 v8::internal::Heap::CollectGarbage+2137
10: 00007FF7986FE0B0 v8::internal::Heap::AllocateExternalBackingStore+2000
11: 00007FF7987229E6 v8::internal::Factory::NewFillerObject+214
12: 00007FF798455C25 v8::internal::DateCache::Weekday+1797
13: 00007FF7989034B1 v8::internal::SetupIsolateDelegate::SetupHeap+494417
14: 0000028E28DF93DE

I get the same error too. I am working with a single PDF and i get the same result described above.

same here, any solution?

Same error here.
EDIT: I fixed it by giving node more ram.

"start": "react-scripts --max-old-space-size=8192 start",