I have a node project that uses the module native-node-printer with edge-js module (for windows platform) when trying to package it using pkg module it gives this error :
Warning Cannot resolve '
../../${ process.env.NNP_PACKAGE }' C:\VisualSutdioCode\ticketing-2019\pkg\print-scan-server\node_modules\node-native-printer\src\windows_printer.js Dynamic require may fail at run time, because the requested file is unknown at compilation time and not included into executable. Use a string literal as an argument for 'require', or leave it as is and specify the resolved file name in 'scripts' option.
the edge-js is refereneced in the native-node-printer.
Anyone can help me on that ?
best regards,
edit the "node_modules\node-native-printer\src\windows_printer.js" as below
after the app is packaged using pkg, copy the node_modules/node-native-printer/lib folder to your app root. your directory structure should be like as below
if you don't updated the dllPath you probably will get an error similar to the one below
Hope this helps!