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.

Cannot find module '../node_modules/refractor/lang/markup.js'

See original GitHub issue

🐛 bug report

Parcel doesn’t seem to able compile package refractor. I get the error Uncaught (in promise) Error: Cannot find module '../node_modules/refractor/lang/markup.js' even though the file markup.js is in place.

🎛 Configuration (.babelrc, package.json, cli command)

"babel": {
    "presets": [
      "@babel/preset-env",
      "@babel/preset-react"
    ],
    "plugins": [
      "@babel/plugin-proposal-class-properties",
      "@babel/plugin-syntax-class-properties",
      "@babel/plugin-syntax-dynamic-import"
    ]
  }

🤔 Expected Behavior

Shouldn’t throw any errors since the package is fine

😯 Current Behavior

Uncaught (in promise) Error: Cannot find module '../node_modules/refractor/lang/markup.js'
    at newRequire (bundler.73ee101b.js:37)
    at newRequire (core.9a94de7c.js:29)
    at newRequire (refractor.5c664bab.js:29)
    at newRequire (core.9a94de7c.js:21)
    at localRequire (core.9a94de7c.js:53)
    at Object.parcelRequire.../node_modules/refractor/core.js.hastscript (core.js:23)
    at newRequire (core.9a94de7c.js:47)
    at newRequire (refractor.5c664bab.js:29)
    at newRequire (bundler.73ee101b.js:21)
    at localRequire (bundler.73ee101b.js:53)

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 1.12.3
Node 12.3.1
Yarn 1.16
Operating System Ubuntu 18.04

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
mrbrianhintoncommented, Sep 26, 2019

I’m seeing this same error.

I’m trying to use the react-syntax-highlighter package. I do see markup.js in node_modules.

import React from 'react';

import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
import { dark } from 'react-syntax-highlighter/dist/esm/styles/prism';

import { Typography } from 'antd';
const { Title } = Typography;

const Home = () => {
  const codeString = '(num) => num + 1';
  return (
      <div style={{ background: '#fff', minHeight: 280, borderRadius: '4px' }}>
        <Title level={2}>Introduction</Title>
        <p>This is WEBS 'official' Prototype-Admin example guide. Prior experience with other frameworks helps, but is not required.</p>
        <p>To get started simply run </p>
        <SyntaxHighlighter language="javascript" style={dark}>
          {codeString}
        </SyntaxHighlighter>
        <h4>Hello, home!</h4>
      </div>
  );
}

export default Home;
0reactions
sogaanicommented, Jun 11, 2020

I met this issue and use a workaround below.

async function startApplication(){
  await import('refractor');
  const App = await import('component which import react-syntax-highlighter');
  ReactDOM.render(<App />, document.getElementById('root'));
}

startApplication();
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 >
cannot find module [Node npm Error Solved] - freeCodeCamp
The module (package) not found is always specified in the format "Module not found: Error: Can't resolve 'package name' in 'project directory".
Read more >
Node.js cannot find module & etc. · Issue #309 · nodejs/help
So i have a node.js script that came with some modules and i am struggling to run it (Debian 7). this is my...
Read more >
How to resolve "Cannot find module" error in Node - Sabe.io
To fix the Cannot find module error, simply install the missing modules using npm . To so, you can use the following command:...
Read more >
Cannot find module (node.js / npm) - javascript - Super User
You're telling node to execute a script called run , with index.js being an argument to run : Usage: node [options] [ -e...
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