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 '@babel/core'

See original GitHub issue

Cannot find module ‘@babel/core

Current behavior I’m trying to use @babel/eslint-parser in a Next.js project, but I’m receiving this message: “Cannot find module ‘@babel/core’”. Of course, I already installed it. Already tried deleting node_modules and reinstalling everything again.

.eslintrc.json (file on the root of my project)

{
  "parser": "@babel/eslint-parser",
  "env": {
    "browser": true,
    "es6": true
  },
  "extends": [
    "eslint:recommended",
    "plugin:react/recommended",
    "plugin:jsx-a11y/recommended",
    "plugin:prettier/recommended",
    "plugin:react-hooks/recommended"
  ],
  "plugins": ["@babel"],
  "rules": {
    "prettier/prettier": ["error", {}, { "usePrettierrc": true }],
    "react/react-in-jsx-scope": "off",
    "jsx-a11y/anchor-is-valid": [
      "error",
      {
        "components": ["Link"],
        "specialLink": ["hrefLeft", "hrefRight"],
        "aspects": ["invalidHref", "preferButton"]
      }
    ]
  },
  "settings": {
    "react": {
      "version": "detect"
    }
  }
}

.babelrc (file on the root of my project)

{
  "presets": [
    [
      "next/babel",
      {
        "preset-env": {},
        "transform-runtime": {},
        "styled-jsx": {},
        "class-properties": {}
      }
    ]
  ],
  "plugins": [
    [
      "styled-components",
      {
        "ssr": true,
        "displayName": true,
        "preprocess": false
      }
    ]
  ]
}

Expected behavior I was expecting that the parser could find @babel/core. It is installed and I can find it inside node_modules.

Environment


“devDependencies”: { “@babel/core”: “^7.12.9”, “@babel/eslint-parser”: “^7.12.1”, “@babel/eslint-plugin”: “^7.12.1”, “babel-plugin-styled-components”: “^1.12.0”, “eslint”: “^7.14.0”, “eslint-config-prettier”: “^6.15.0”, “eslint-plugin-jsx-a11y”: “^6.4.1”, “eslint-plugin-prettier”: “^3.1.4”, “eslint-plugin-react”: “^7.21.5”, “eslint-plugin-react-hooks”: “^4.2.0”, “eslint-plugin-simple-import-sort”: “^5.0.3”, “prettier”: “^2.2.0” }

Possible Solution

Additional context

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sinuheshinbrcommented, Dec 3, 2020

Hey, I just restarted my pc and it’s working now. Well, thx for the support!

0reactions
sinuheshinbrcommented, Dec 2, 2020

This is from ESlint output from VSCode

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
Cannot find module 'babel-core' · Issue #124 - GitHub
I've just updated from 6.1.2 to 7.0.0 and I now get this error message: [17:08:05] 'requirejs' errored after 68 ms [17:08:05] Error: Cannot...
Read more >
Cannot find module '@babel/core' error [Solved] | bobbyhadz
To solve the error "Cannot find module '@babel/core'", make sure to install the @babe/core package by opening your terminal in your project's root...
Read more >
Error: Cannot find module 'babel-core/register' - MongoDB
Hi team, I am getting an 'Error: Cannot find module 'babel-core/register' after running npm install and npm start.
Read more >
Node.js – Cannot find module '@babel/core' - iTecNote
Node.js – Cannot find module '@babel/core'. babeljsnode.jsnpmreactjswebpack. I am following along with this webpack4/react tutorial:.
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