question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@azure/cosmos@3.17.0 - cannot find module @azure/identity

See original GitHub issue

Environment

Describe the bug

@azure/cosmos@3.17.0 (the latest), when require’d, has a Cannot find module error for @azure/identity.

Error: Cannot find module '@azure/identity'
Require stack:
- ~/Desktop/tmp/azure-cosmos-test/node_modules/@azure/cosmos/dist/index.js

@azure/identity is only a devDependency: https://github.com/Azure/azure-sdk-for-js/blob/57387dcc64a57d7e1d524291752c6c576af28ef7/sdk/cosmosdb/cosmos/package.json#L110

To Reproduce

Steps to reproduce the behavior:

  1. mkdir test
  2. cd test
  3. npm init -y
  4. npm i @azure/cosmos@3.17.0
  5. echo ‘require(“@azure/cosmos”)’ > index.js
  6. node index.js

Expected behavior

No errors when importing/requiring the @azure/cosmos module.

Actual behavior

Cannot find module @azure/identity error encountered when importing/requiring the @azure/cosmos module.

Workaround

Pin to @azure/cosmos@3.16.4 <-- note no caret! ^

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:9
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
sajeetharancommented, Aug 22, 2022

@jay-most Looks like a blocking issue, can you please check asap?

2reactions
shazroncommented, Sep 13, 2022

I can confirm that with the repro steps above with v3.17.1, the issue is resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Functions: Cannot find module '@azure/cosmos'
I run rm -r ./node_modules via SSH in Azure portal and rerun git push . Then, @azure/cosmos was installed.
Read more >
azure static site API sporadically fail with "azure/cosmos" not ...
I get following exception when running API ... Worker was unable to load function GetTaskList: 'Error: Cannot find module '@azure/cosmos'.
Read more >
Artifactory npm task (ArtifactoryNpm@2) giving error
It was working fine till yesterday but today we are getting issue of module azure-pipelines-task-lib/task' not found . we have also tried npm@1...
Read more >
Module not found with Node on App Service Linux -
At a high level, seeing error: cannot find module [someModuleName] means this ... <anonymous> (/home/site/wwwroot/index.js:1:17) at module.
Read more >
SonarCloud error in Azure build pipeline for blazer project Error
... Module.require (internal/modules/cjs/loader.js:690:17) ERROR: throw err; ERROR: ^ ERROR: ERROR: Error: Cannot find module 'typescript' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found