Cannot find module 'diagnostic-channel'
See original GitHub issueI 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)
Issue Analytics
- State:
- Created 6 years ago
- Comments:25 (13 by maintainers)
Top Results From Across the Web
diagnostic-channel - npm
Provides a context-saving pub/sub channel to connect diagnostic event publishers and subscribers. Latest version: 1.1.0, last published: a ...
Read more >Firebase functions Error: Cannot find module 'diagnostics'
I recently (couple weeks ago) updated my functions directory from Node 8 to Node 10, not sure if that is related to this...
Read more >Diagnostics Channel | Node.js v19.3.0 Documentation
The node:diagnostics_channel module provides an API to create named channels to report arbitrary message data for diagnostics purposes.
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
When you get the “cannot find module” error, or “module not found”, it means you've not installed the package you're trying to use....
Read more >How to solve "Error: Cannot find module '*.js'" with Node.js
then you are most likely trying to run the wrong file. It is possible you are missing a dependency that is needed from...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.jsonfile is readable, andnode_modules\diagnostic-channel\dist\channel.jsexists.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
.distfolder 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?