microsoft / ApplicationInsights-node.js

Microsoft Application Insights SDK for Node.js
MIT License
320 stars 138 forks source link

Errors when building Electron app #1234

Open JerryLeeMelton opened 8 months ago

JerryLeeMelton commented 8 months ago

I've integrated Application Insights into an Electron app that I'm working on and I've run into a problem when trying to build the app. The app was working correctly when would run it from my console (using yarn start) but as soon as I run yarn make to build the app I get the following errors:

`An unhandled error has occurred inside Forge: Compilation errors in the main process: assets by status 836 KiB [cached] 1 asset runtime modules 793 bytes 4 modules modules by path ./node_modules/ 1.25 MiB javascript modules 885 KiB 128 modules json modules 394 KiB ./node_modules/mime-db/db.json 140 KiB [built] [code generated] ./node_modules/tr46/lib/mappingTable.json 254 KiB [built] [code generated] modules by path ./src/ 164 KiB modules by path ./src/eLab/*.ts 29.2 KiB ./src/eLab/getAuth.ts 2.22 KiB [built] [code generated] ./src/eLab/Api.ts 27 KiB [built] [code generated] ./src/main.ts 121 KiB [built] [code generated] ./src/main/startup.ts 13.5 KiB [built] [code generated] 21 modules

ERROR in ./src/main.ts 542:22-52 Module not found: Error: Can't resolve 'applicationinsights' in 'C:\Users\theje\Rewire\polygon-app\src' resolve 'applicationinsights' in 'C:\Users\theje\Rewire\polygon-app\src' Parsed request is a module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./src) resolve as module looking for modules in C:\Users\theje\Rewire\polygon-app single file module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\applicationinsights doesn't exist looking for modules in C:\Users\theje\Rewire\polygon-app\node_modules single file module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./node_modules/applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights doesn't exist looking for modules in C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules single file module using description file: C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\package.json (relative path: ./node_modules/applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights doesn't exist

webpack 5.44.0 compiled with 1 error in 5918 ms Error: Compilation errors in the main process: assets by status 836 KiB [cached] 1 asset runtime modules 793 bytes 4 modules modules by path ./node_modules/ 1.25 MiB javascript modules 885 KiB 128 modules json modules 394 KiB ./node_modules/mime-db/db.json 140 KiB [built] [code generated] ./node_modules/tr46/lib/mappingTable.json 254 KiB [built] [code generated] modules by path ./src/ 164 KiB modules by path ./src/eLab/*.ts 29.2 KiB ./src/eLab/getAuth.ts 2.22 KiB [built] [code generated] ./src/eLab/Api.ts 27 KiB [built] [code generated] ./src/main.ts 121 KiB [built] [code generated] ./src/main/startup.ts 13.5 KiB [built] [code generated] 21 modules

ERROR in ./src/main.ts 542:22-52 Module not found: Error: Can't resolve 'applicationinsights' in 'C:\Users\theje\Rewire\polygon-app\src' resolve 'applicationinsights' in 'C:\Users\theje\Rewire\polygon-app\src' Parsed request is a module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./src) resolve as module looking for modules in C:\Users\theje\Rewire\polygon-app single file module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\applicationinsights doesn't exist looking for modules in C:\Users\theje\Rewire\polygon-app\node_modules single file module using description file: C:\Users\theje\Rewire\polygon-app\package.json (relative path: ./node_modules/applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\node_modules\applicationinsights doesn't exist looking for modules in C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules single file module using description file: C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\package.json (relative path: ./node_modules/applicationinsights) no extension C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights doesn't exist .js C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.js doesn't exist .ts C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.ts doesn't exist .jsx C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.jsx doesn't exist .tsx C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.tsx doesn't exist .css C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.css doesn't exist .json C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.json doesn't exist .png C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.png doesn't exist .gif C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights.gif doesn't exist C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\node_modules\applicationinsights doesn't exist

webpack 5.44.0 compiled with 1 error in 5918 ms at cb (C:\Users\theje\Rewire\polygon-app\node_modules\@electron-forge\plugin-webpack\src\WebpackPlugin.ts:252:31) at finalCallback (C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compiler.js:425:32) at C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compiler.js:442:13 at Hook.eval [as callAsync] (eval at create (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\Hook.js:18:14) at onCompiled (C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compiler.js:440:21) at C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compiler.js:1118:17 at Hook.eval [as callAsync] (eval at create (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\Hook.js:18:14) at C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compiler.js:1114:33 at finalCallback (C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compilation.js:2249:11) at C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compilation.js:2540:11 at Hook.eval [as callAsync] (eval at create (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1) at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\Hook.js:18:14) at C:\Users\theje\Rewire\polygon-app\node_modules\webpack\lib\Compilation.js:2533:38 at eval (eval at create (C:\Users\theje\Rewire\polygon-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), :17:1) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`

Any thoughts on how this could be resolved? We're at a bit of a loss trying to fix this issue. Thanks so much.

JacksonWeber commented 8 months ago

@JerryLeeMelton What version of the SDK are you using? And can I see what dependencies you're running with?

Dev-Lab-DZ commented 1 month ago

any updates on how to fix that , am facing the same error when npm run make !!!

JacksonWeber commented 1 month ago

@Dev-Lab-DZ What version of the SDK are you using? And can I see what dependencies you're running with?