Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve './chaos-react.cjs.development.js' in '/home/xxxxx/chaos-demo/node_modules/react-chaos/dist #51

Open
gatwirival opened this issue Jun 24, 2023 · 0 comments

Comments

@gatwirival
Copy link

Hi, I am experiencing this error when I use the package.

Compiled with problems:
×
ERROR
Cannot find module './chaos-react.cjs.development.js'
    at webpackMissingModule (http://localhost:3000/static/js/bundle.js:7050:69)
    at ./node_modules/react-chaos/dist/index.js (http://localhost:3000/static/js/bundle.js:7050:176)
    at options.factory (http://localhost:3000/static/js/bundle.js:41417:31)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:40840:33)
    at fn (http://localhost:3000/static/js/bundle.js:41074:21)
    at ./src/App.js (http://localhost:3000/static/js/bundle.js:17:69)
    at options.factory (http://localhost:3000/static/js/bundle.js:41417:31)
    at __webpack_require__ (http://localhost:3000/static/js/bundle.js:40840:33)
    at fn (http://localhost:3000/static/js/bundle.js:41074:21)
    at ./src/index.js (http://localhost:3000/static/js/bundle.js:119:62)
ERROR in ./node_modules/react-chaos/dist/index.js 6:2-62
Module not found: Error: Can't resolve './chaos-react.cjs.development.js' in '/home/xxxxx/chaos-demo/node_modules/react-chaos/dist'

What I tried

  • Deleting package-lock.json and running npm install
  • Verified that the module 'react-chaos' is installed in my project by running npm list react-chaos

my code

import React from 'react';
import withChaos from 'react-chaos';

// Define a component
const ComponentToWrap = () => {
  // Simulate an error
  if (Math.random() < 0.5) {
    throw new Error('Oops! Something went wrong.');
  }

  return <p>I may have chaos.</p>;
};

// Wrap the component with Chaos
const ComponentWithChaos = withChaos(ComponentToWrap, 8, 'Custom error message: Chaos level 8');

// Create a component with Chaos level 8 and a custom error message
const App = () => {
  return (
    <div>
      <h1>React Chaos Demo</h1>
      <ComponentWithChaos />
    </div>
  );
};

export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant