Cannot find module '@babel/core'
See original GitHub issueCannot 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:
- Created 3 years ago
- Comments:7 (2 by maintainers)
Top GitHub Comments
Hey, I just restarted my pc and it’s working now. Well, thx for the support!
This is from ESlint output from VSCode