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.

Error when trying to run the create-react-app example

See original GitHub issue

Subject of the issue

I get an error when trying to run the create-react-app example.

Your environment

Windows 10 Node v10.14.0 NPM 6.4.1

Steps to reproduce

Easy. I do: git clone cd mdx/examples/create-react-app npm i npm start

Expected behaviour

The app should run without errors.

Actual behaviour

I get this error when running the app;

Failed to compile
./src/App.js
Module not found: You attempted to import C:\Repos\mdx\examples\create-react-app\node_modules\.cache\mdx.macro\Content.796904d8db.mdx.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
nicobrinkkempercommented, Jun 14, 2020

I don’t understand why this issue is still open since Dec 22, 2018.

var _jsxFileName = "C:\\Users\\nico\\Documents\\Code\\fourymm\\src\\data\\Welcome.mdx";
import React from 'react';
import { MDXTag } from '@mdx-js/tag';
import 'C:\Users\nico\Documents\Code\fourymm\src\data\Welcome.mdx';

The top line is fine, the bottom line is just plain wrong? This should be a easy fix for a maintainer right? Meanwhile it’s stopping everyone trying this out on Windows, following the documented advice to use mdx.macro for create-react-app projects. The above fixes seem either very radical (ejecting) and outdated (using .env file). I’m sorry for sounding harsh, maybe I’m missing something? Please help me understand

Edit: just to add to the pool of solution. Using WSL can solve this problem. It’s a bit slower, and even more so if you keep the folder where it is, so I suggest moving the folder to the WSL home directory.

1reaction
thediveocommented, Dec 16, 2020

Using “// eslint-disable-next-line import/no-webpack-loader-syntax” immediately before the import now results in “Cannot find module ‘!babel-loader!mdx-loader!./About.mdx’ or its corresponding type declarations.ts(2307)”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create React App not working - Stack Overflow
1. update the npm version (npm install npm@latest -g) · 2. clear the cache (npm cache clean --force) · 3. create the react...
Read more >
npx create-react-app is not working · Issue #10132 - GitHub
First, you'll need to uninstall "create-react-app" using the "npm uninstall -g create-react-app" command. Run "npx create-react-app my-app" each ...
Read more >
create-react-app: command not found (React) error [Solved]
Use `npx` to solve the error create-react-app: command not found, e.g. `npx create-react-app my-app` or install the package globally by running `npm install ......
Read more >
What To Do if create-react-app Doesn't Work
Another rather simple remedy for the create-react-app blues. You can try simply reinstalling the latest version of npm. To check what version of ......
Read more >
npx create-react-app not working? Here's the solution.
x.x of create-react-app/react-scripts, then you may notice an error when you run the command below, as it tries to use the latest version...
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