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 [BABEL]: ... "Cannot find module 'js-levenshtein'"

See original GitHub issue

Bug report

I’ve tried with my custom babel.config.js file, I’ve tried having deleted said file (which isn’t doing much) but I’m getting a compilation error after upgrading from 9.3.6 to 9.4.0.

Possibly related to #12779 and/or #12740

Describe the bug

A clear and concise description of what the bug is.

Compilation bug in the console of VSCode:

error - ./node_modules/next/dist/client/dev/amp-dev.js Error: [BABEL] /**myfilepaths**/node_modules/next/dist/client/dev/amp-dev.js: Cannot find module 'js-levenshtein' Require stack:

here’s my next.config:

module.exports = {
  publicRuntimeConfig: config,
  serverRuntimeConfig: config,
  webpack(config, options = {}) { 
    config.module.rules.push({
      test: /\.svg$/,
      use: [
        {
          loader: 'react-svg-loader',
        },
      ],
    },
    {
      test: /\.(png|jpe?g|gif)$/i,
      use: [
        {
          loader: 'file-loader',
        },
      ],
    })
    return config;
  },
}

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • OS: macOS
  • Browser (if applies) [e.g. chrome, safari]
  • Version of Next.js: 9.4.0
  • Version of Node.js: [e.g. 10.10.0]

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

37reactions
lauralouisetcommented, May 13, 2020

yarn cache clean didn’t fix it – however, deleting /node_nodules and .next folder and doing fresh yarn install seems to fix the issue. Closing – hope this can help anyone else who comes across this error message.

9reactions
thomaszdxsncommented, May 13, 2020

same error when upgrade next.js version, resolved by delete node_modules.

but in vercel, deploy is fail, since it used build cache

Read more comments on GitHub >

github_iconTop Results From Across the Web

js-levenshtein - npm
The most efficient JS implementation calculating the Levenshtein distance, i.e. the difference between two strings.. Latest version: 1.1.6, ...
Read more >
Cannot find module '@babel/core' - node.js - Stack Overflow
Try running this. npm install @babel/core --save. babel changed their package so your babel-core will not be the same as @babel/core .
Read more >
Upgrade ReactJS - module build failed - ShareChiWai Notes
Upgrade ReactJS - module build failed - Cannot find module 'js-levenshtein'. Last updated on Jul 1, 2022 1 min read. 用了ReactJS 一段時間…
Read more >
React Hot Loader | Best of JS
On Hot Module Update we will inject componentDidCatch and a special render to every Class-based component you have, making Error Boundaries more local....
Read more >
Babel Problem : Cannot find module - Big Nerd Ranch Forums
I've got this error: Failed at the chattrbox@1.0.0 build script 'browserify -d app/scripts/src/main.js -o app/scripts/dist/main.js'. npm ERR!
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