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.

Uncaught Error: Cannot find module 'cloudinary-react/lib/components/CloudinaryContext' from 'cloudinary-react/lib/index.js'

See original GitHub issue

This is my code

import React from 'react';
import {Image, CloudinaryContext, Transformation} from 'cloudinary-react';

class ImageUpload extends React.Component {
  render() {
    return(
      <div>
        <h1>Hello, world!</h1>
        <Image cloudName="demo" publicId="sample" width="300" crop="scale"/>
      </div>
    );
  }
}

export default ImageUpload;

In the console:

Uncaught Error: Cannot find module 'cloudinary-react/lib/components/CloudinaryContext' from 'cloudinary-react/lib/index.js'

But the folder Exists (I’m installed via npm)

What is the problem?

Thanks

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
eitanp461commented, Feb 9, 2017

@hmontes It is definitely brunch.io, it works fine out of the box with Webpack.

Brunch are not using standard NPM package lookups, and loads all modules with their resolved name, e.g. it caches cloudinary-react/lib/components/CloudinaryComponent/CloudinaryComponent.js

However our code is using the module folders as modules pattern, so it requires cloudinary-react/lib/components/CloudinaryComponent which cannot be resolved by Brunch.

Nevertheless, you can overcome this issue by aliasing Cloudinary’s files in your brunch-config.js by adding:

exports.npm = {
  aliases: {
    "cloudinary-react/lib/components/CloudinaryContext": "cloudinary-react/lib/components/CloudinaryContext/CloudinaryContext.js",
    "cloudinary-react/lib/components/CloudinaryComponent": "cloudinary-react/lib/components/CloudinaryComponent/CloudinaryComponent.js",
    "cloudinary-react/lib/components/Image": "cloudinary-react/lib/components/Image/Image.js",
    "cloudinary-react/lib/Util": "cloudinary-react/lib/Util/Util.js",
    "cloudinary-react/lib/components/Transformation": "cloudinary-react/lib/components/Transformation/Transformation.js",
    "cloudinary-react/lib/components/Video": "cloudinary-react/lib/components/Video/Video.js"
  }
}
0reactions
eitanp461commented, Feb 11, 2017

@hmontes Where did you see that error? What was the command you were running?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >
Uncaught Error: Cannot find module "." · Issue #4921 - GitHub
What is the current behavior? Below exception: polyfills.js:1 Error: Cannot find module "." at webpackMissingModule (eval at 148 (http:// ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\ ...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
When you are working in Node, you will sometimes encounter the error Cannot find module 'module-name' with the error code MODULE_NOT_FOUND .
Read more >
Fix a CloudWatch canary that's failing with the error "Cannot ...
zip file of your function and dependencies, then you receive an error. The error message reads: Cannot find module '/opt/nodejs/node_modules/ ...
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