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 "../maps/decode.json"

See original GitHub issue

After searching for a framework to replace the popular Draftjs, I stumbled upon Slate. I started reading the docs, and tried to create a basic Slate example. I copied the basic example from this page of the docs. After creating a new React component in my local environment and pasting in that code, I was presented with the following error:

Cannot find module "../maps/decode.json"

I have no idea what this means. I don’t know if the issue is with Webpack or Slate; however, I’m leaning more towards the former.

I think the best way for you to understand what’s going on is to try it yourself. I created a temporary Github repo with my attempt to create the simple Slate example. It’s really small, just a simple React boilerplate.

To recreate this error:

  • Download or clone my repo’s directory to your computer.
  • Install the dependencies with npm install
  • Run the Express server with npm start
  • Navigate to localhost:3000

I appreciate your time and look forward to a response. Can’t wait to use this awesome framework, appreciate you open sourcing it.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
MatthewKosloskicommented, Aug 31, 2016

It works! Thanks, guys. I can’t wait to start building my editor 😃

Just for those who may encounter the same error:

All you have to do is install json-loader and add the following object to the loaders array within the Webpack config:

{
    test: /\.json$/,
    include: /node_modules/,
    loader: 'json-loader'
}
0reactions
oyeanujcommented, Feb 6, 2017

I ran into this issue as well, with an additional complication of having the initialState.json for the editor in the src folder. Here is the solution that worked for me (enhancement to the one mentioned above), incase anyone else encounters it.

{
    test: /\.json$/,
    include: [
       /node_modules/,
      path.resolve(__dirname, '..')
    ],
    loader: 'json-loader'
}

In my case, the initial problem was being created via cheerio, so hopefully, it will completely disappear with #55 or upgrade to webpack 2.0.

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 >
jsconfig.json Reference - Visual Studio Code
js doesn't reference a file b.ts explicitly (either using import or CommonJS modules), there is no common project context between the two files....
Read more >
@rollup/plugin-json - npm
A Rollup plugin which Converts .json files to ES6 modules. Requirements. This plugin requires an LTS Node version (v14.0.0+) and Rollup v1.
Read more >
Cannot find module '<project path>/src/package.json' after run ...
Hello, good day, I've an annoying problem, I wanted to jump to the package.json file but by mistake I click over "package.json file......
Read more >
Fixing The "Cannot Find Module" Error In TypeScript
The package import contains a spelling mistake. Something is wrong with your tsconfig.json file. This article will analyze those four potential ...
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