ApplicationInsights-node.js: Cannot find module 'diagnostic-channel'
I am trying to add application insights to my node/express app. I have applicationinsights v0.20.0 installed and now I am getting this error and my app will not run. I do see the ‘diagnostic-channel’ folder in that directory so I am not sure why it says it cannot locate it. On previous projects, I did not have this ‘diagnostic-channel’ when using app insights. Any thoughts?
Application has thrown an uncaught exception and is terminated:
Error: Cannot find module 'diagnostic-channel'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\home\site\wwwroot\node_modules\applicationinsights\out\AutoCollection\CorrelationContextManager.js:4:28)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 25 (13 by maintainers)
Commits related to this issue
- Updated diagnostic-channel, added subscribers for winston and pg fixes #256 — committed to jackhorton/ApplicationInsights-node.js by deleted user 7 years ago
- Updated diagnostic-channel, added subscribers for winston and pg (#303) * Updated diagnostic-channel, added subscribers for winston and pg fixes #256 * Updated README.md — committed to microsoft/ApplicationInsights-node.js by jackhorton 7 years ago
Hi @OsvaldoRosado @AlexBulankou I just encountered this issue with Node v6.9.4, npm v3.10.10, and applicationinsights v1.0.1. My app is running locally, so it can’t be a permissions/deploy problem.
This is the error message:
This is my npm node module structure:
The
node_modules\diagnostic-channel\package.json
file is readable, andnode_modules\diagnostic-channel\dist\channel.js
exists.Any ideas?
UPDATE: Quickly figured out I was using wrong module, should have been using applicationinsights-js for client-side app insights. Making this note for anyone who stumbles across this issue. Thanks!
@MSLaguana the
.dist
folder seems to be fairly unreliably deployed given the history of this bug. What do you think of renaming it to no longer being a dot-folder?We’ve encountered the same issue and it turned out that due to our build process, the
.dist
folder insidediagnostic-channel
module was being omitted, that is because by defaultgrunt-copy
does not copy dot folders.