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.

[2.0] "Cannot find module 'x' from 'y'"

See original GitHub issue

🐛 bug report

I tried running Parcel 2 alpha in my project to see how it goes, and I was presented with an error “Cannot find module…”.

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

// .babelrc
{
  "presets": [
    ["@babel/preset-env", {
      "modules": false,
      "useBuiltIns": "usage",
      "corejs": 3
    }],
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-optional-chaining"
  ],
}

CLI command:

    "start": "parcel src/index.html --cache-dir ./.cache/dev",

🤔 Expected Behavior

Parcel to successfully resolve paths and build the application like in 1.x

😯 Current Behavior

Server running at http://localhost:1234
🚨 Cannot find module '../components/pages/form/step_context' from '/Users/wojciech.maj/P
rojekty/cfola/src/hooks'
    at ResolverRunner.resolve (/Users/wojciech.maj/Projekty/cfola/node_modules/@parcel/co
re/lib/ResolverRunner.js:71:15)
    at async RequestGraph.resolvePath (/Users/wojciech.maj/Projekty/cfola/node_modules/@p
arcel/core/lib/RequestGraph.js:400:24)
    at async PromiseQueue._runFn (/Users/wojciech.maj/Projekty/cfola/node_modules/@parcel
/utils/lib/PromiseQueue.js:94:7)
    at async PromiseQueue._next (/Users/wojciech.maj/Projekty/cfola/node_modules/@parcel/
utils/lib/PromiseQueue.js:81:5)

And below the spinner is just stuck, rotating on:

⠏ Building checkmark.svg...

Obviously, this path (/Users/wojciech.maj/P rojekty/cfola/src/components/pages/form/step_context) is very much there so I don’t know why this problem occurred.

💁 Possible Solution

🔦 Context

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.0.0-alpha.2.1
Node 12.4.0
npm/Yarn 1.19.1
Operating System MacOS Catalina

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
wojtekmajcommented, Nov 14, 2019

Can we get it on this hardcoded list just for now, for me to be able to continue testing Parcel 2 Alpha?

1reaction
mischniccommented, Oct 17, 2019

The reason is that jsx is missing in this array: https://github.com/parcel-bundler/parcel/blob/96c25fa775395f005d6b483020d6b522d29d3dfe/packages/resolvers/default/src/DefaultResolver.js#L33

But the goal is to get rid of this hardcoded list anyway…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest gives `Cannot find module` when importing components ...
I think you're looking for: roots or modulePaths and moduleDirectories. You can add both relative and absolute paths.
Read more >
CommonJS modules | Node.js v19.3.0 Documentation
LOAD_NODE_MODULES(X, dirname(Y)) 7. THROW "not found" LOAD_AS_FILE(X) 1. If X is a file, load X as its file extension format. STOP 2. If...
Read more >
Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
tslib - npm
This is a runtime library for TypeScript that contains all of the TypeScript helper functions. This library is primarily used by the -- ......
Read more >
Find-Module (PowerShellGet) - PowerShell | Microsoft Learn
Standard version numbers have a format of x.y.z where x, y, ... Find-Module returns the newest version of the module that does not...
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