Skip to main content
Answer

Modern UI npm run build-dev Cannot find module 'pdfjs-dist' or its corresponding type declarations

  • November 17, 2025
  • 5 replies
  • 58 views

Forum|alt.badge.img+1

I’m trying to prepare some customisation projects for 2025R2; because I’ll need a load of real data to test it afterwards my starting point was a new instance created using 24.208.0020 that I upgraded to 25.200.0248.

Once I’d established that all my projects with only Classic UI forms published successfully, I started to replicate the form changes in Modern UI.

  • So using Powershell I ran:
    npm run getmodules
    npm run build-dev

But my problem is now that the build fails with errors like:

ERROR in ./src/screens/AP/AP301100/documentRecognition/pdfViewer/pdf-viewer.ts 10:0-62

Module not found: Error: Can't resolve 'pdfjs-dist' in 'C:\AcumaticaTenants\AcuQBRE2\FrontendSources\screen\src\screens\AP\AP301100\documentRecognition\pdfViewer'

 

That module does appear to be present within the node_modules folder at:

C:\[instance]\FrontendSources\screen\node_modules\pdfjs-dist

 

What else might be wrong?

Best answer by allisterchambers48

I’ve compared the two installations. The failing instance (the one created by upgrading from 24R2) lacks several files in FrontEndSources\screen\node_modules\pdfjs-dist.

It’s missing all files with extensions:

  • .ts
  • .mjs
  • .mts
  • .pfb
  • .ttf
  • .md

Error message from “npm run build-dev” was:


ERROR in ./src/screens/AP/AP301100/documentRecognition/pdfViewer/pdf-viewer.ts 10:0-62
Module not found: Error: Can't resolve 'pdfjs-dist' in 'C:\AcumaticaTenants\AcuQBRE2\FrontendSources\screen\src\screens\AP\AP301100\documentRecognition\pdfViewer'

ERROR in ./src/screens/AP/AP301100/documentRecognition/pdfViewer/pdf-viewer.ts 86:18-63
Module not found: Error: Can't resolve 'pdfjs-dist/build/pdf.worker.min.mjs' in 'C:\AcumaticaTenants\AcuQBRE2\FrontendSources\screen\src\screens\AP\AP301100\documentRecognition\pdfViewer'

 

Having copied the missing files from a working instance (clean install from scratch), the error goes away.

 

Worth noting that both instances were created using the same copy of AcumaticaConfig.exe 

5 replies

Forum|alt.badge.img+3

Have you run the npm run getmodules command from the FrontendSources folder (and not from FrontendSources\screen)?

Both npm run getmodules and npm run build-dev must be executed from the FrontendSources folder.

However, a command like npm run build-dev --- --env screenIds=SO301000 should be run from the FrontendSources\screen folder.


Forum|alt.badge.img+1

I’ve managed to work around this by installing a new instance of 25.208.0020 from scratch. Copying the customisations and data using snapshots.

“npm run build-dev” completes without errors on that clean instance.


Forum|alt.badge.img+1

I ran “npm run getmodules” from both FrontEndSources and FrontEndSources\screen. Both gave the same error.

 


darylbowman
Captain II
Forum|alt.badge.img+15

I ran “npm run getmodules” from both FrontEndSources and FrontEndSources\screen. Both gave the same error.

Do you mean a build command following getmodules gives the same error or the getmodules command itself? What error does it give?


Forum|alt.badge.img+1

I’ve compared the two installations. The failing instance (the one created by upgrading from 24R2) lacks several files in FrontEndSources\screen\node_modules\pdfjs-dist.

It’s missing all files with extensions:

  • .ts
  • .mjs
  • .mts
  • .pfb
  • .ttf
  • .md

Error message from “npm run build-dev” was:


ERROR in ./src/screens/AP/AP301100/documentRecognition/pdfViewer/pdf-viewer.ts 10:0-62
Module not found: Error: Can't resolve 'pdfjs-dist' in 'C:\AcumaticaTenants\AcuQBRE2\FrontendSources\screen\src\screens\AP\AP301100\documentRecognition\pdfViewer'

ERROR in ./src/screens/AP/AP301100/documentRecognition/pdfViewer/pdf-viewer.ts 86:18-63
Module not found: Error: Can't resolve 'pdfjs-dist/build/pdf.worker.min.mjs' in 'C:\AcumaticaTenants\AcuQBRE2\FrontendSources\screen\src\screens\AP\AP301100\documentRecognition\pdfViewer'

 

Having copied the missing files from a working instance (clean install from scratch), the error goes away.

 

Worth noting that both instances were created using the same copy of AcumaticaConfig.exe