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.

[React-imported-component] Error: Cannot find module 'elliptic'

See original GitHub issue

i have some error :

  1. i have error if i import component my code contain aliases path
  2. style using @emotion/core not apply … but if using inline style from react doc i can be apply error / crash :
🚨 Whoops, we crashed 🚨
Cannot find module 'elliptic'
Stack trace
in UnconnectedReactImportedComponent (created by ReactImportedComponent)
in ReactImportedComponent (created by ImportedComponent)
in ImportedComponent (created by ForwardRef)
in ForwardRef (created by AsyncRoute)
in div (created by Context.Consumer)
in Styled(div) (created by Context.Consumer)
in div (created by Context.Consumer)
in Styled(div) (created by Context.Consumer)
in div (created by Context.Consumer)
in Styled(div) (created by Main)
in Main (created by Context.Consumer)
in ThemeConfig (created by Page)
in Page (created by AsyncRoute)
in AsyncRoute (created by Route)
in Route (created by Context.Consumer)
in Switch (created by Context.Consumer)
in MDXProvider (created by DocPreview)
in DocPreview (created by Context.Consumer)
in ThemeProvider (created by Context.Consumer)
in ThemeConfig (created by Theme)
in Theme (created by Theme)
in ScrollToTopBase (created by Route)
in Route (created by withRouter(ScrollToTopBase))
in withRouter(ScrollToTopBase) (created by Theme)
in Router (created by BrowserRouter)
in BrowserRouter (created by Router)
in Router (created by Theme)
in DataServer (created by Theme)
in StateProvider (created by Theme)
in ErrorBoundary (created by Theme)
in Theme (at root.jsx:5)
in Root (created by HotExportedRoot)
in AppContainer (created by HotExportedRoot)
in HotExportedRoot (at app/index.jsx:14)

here my component

import React from 'react'
import { css } from '@emotion/core'
import { Background, Color } from 'Utils'
import PropTypes from 'prop-types'

const Badge = ({ color, children, style, ...props }) => {
  const badge = css`
    font-size: 9px;
    letter-spacing: 1px;
    color: ${ Color.white };
    border-radius: 10px;
    padding: 2px 7px;
    vertical-align: middle;
    display: inline-block;
    font-weight: bold;
  `
  return (
    <div css={ [badge, Background(color), style] } { ...props }>{ children }</div>
  )
}

Badge.propTypes = {
  color: PropTypes.string,
  children: PropTypes.node,
  style: PropTypes.string
}

export default Badge
`
**my doczrc.js config **

`import { alias } from './next.config'

export default {
  title: 'Reactism',
  description: 'Reactism is a React Boilerplate based next.js',
  modifyBundlerConfig: config => {
    console.log("alias",alias)
    const newConfig = {
      ...config,
      resolve: {
        ...config.resolve,
        alias: {
          ...config.resolve.alias,
          ...alias
        }
      },
      module: {
        rules: [
          ...config.module.rules,
          {
            test: /\.css$/,
            use: ['css-loader']
          }
        ]
      }
    }
    return newConfig
  }
}

** and alias on next.config.js **

const aliases = {
  'Containers': path.resolve(__dirname, 'components/containers'),
  'Elements': path.resolve(__dirname, 'components/elements/'),
  'Utils': path.resolve(__dirname, 'components/utilities/'),
  'Layout': path.resolve(__dirname, 'components/pageLayouts/'),
...................
}

anyone can help ?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
willallendevcommented, Sep 5, 2019

@rakannimer This is in my package.json "docz": "^1.2.0", So I guess V1

The big problem is that you would need to changes the imports in the component that you are importing itself. This is far from a good solution

In our case we found that using something like this @components/BrandCard/brand-card.component.js was a bit easier than relative paths

0reactions
stale[bot]commented, Nov 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[React-imported-component] Error: Cannot find module 'elliptic'
i have some error : i have error if i import component my code ... [React-imported-component] Error: Cannot find module 'elliptic' #658.
Read more >
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 >
elliptic - npm
Start using elliptic in your project by running `npm i elliptic`. There are 2342 other projects in the npm registry using elliptic.
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 >
Cannot find module 'X' error in Node.js | bobbyhadz
The "Cannot find module" error in Node.js occurs for multiple reasons: Forgetting to install a third-party package with npm install module-name . Pointing...
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