create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

`react-scripts build` fails with Module not found: Error: Can't resolve '../../helpers/esm/typeof'

Open ickata opened this issue 3 years ago • 3 comments

Describe the bug

After upgrading react-scripts to latest 5.0.0 (was: 4.0.1) I cannot build my project because I get this:

Module not found: Error: Can't resolve '../../helpers/esm/typeof' in '/Users/ickata/Work/Galaxy/node_modules/@babel/runtime/helpers/esm'
Did you mean 'typeof.js'?
BREAKING CHANGE: The request '../../helpers/esm/typeof' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Did you try recovering your dependencies?

Yes, no success.

Which terms did you search for in User Guide?

  • "Module not loaded"
  • "react-scripts build"

Environment

  • MacOS Monterey (12.1)
  • NodeJS v14.17.5
Environment Info:

  current version of create-react-app: 5.0.0
  running from /Users/ickata/.npm/_npx/39396/lib/node_modules/create-react-app

  System:
    OS: macOS 12.1
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
  Binaries:
    Node: 14.17.5 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.14 - /usr/local/bin/npm
  Browsers:
    Chrome: 97.0.4692.99
    Edge: 87.0.664.75
    Firefox: 96.0.2
    Safari: 15.2
  npmPackages:
    react: ^17.0.1 => 17.0.1
    react-dom: ^17.0.1 => 17.0.1
    react-scripts: ^5.0.0 => 5.0.0
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

No exact steps, however I am not able to reproduce the issue w/ a fresh CRA install.

ickata avatar Jan 31 '22 17:01 ickata

Based on https://github.com/mui/material-ui/issues/23290, you need babel-runtime 7.12.0 or newer for it to work with webpack 5.

bebraw avatar Feb 17 '22 10:02 bebraw

But I don’t see it in the dependency list of the generated package.json, even if I create a fresh new app.

ickata avatar Feb 17 '22 23:02 ickata

I am having a similar error with @babel/[email protected].

Edit: my workaround was to avoid the import. In an NexJS app, it works.

ianldgs avatar Sep 29 '22 10:09 ianldgs

Just for those coming back to this with the same issues.

here's my solution: https://github.com/mui/material-ui/issues/23290#issuecomment-1333868837

mribichich avatar Dec 01 '22 14:12 mribichich