Ошибка Requires Babel "^7.0.0-0", but was loaded with "6.26.3"

Пытаюсь запустить дев сервер командой npm run start:dev. Выдает ошибку, что в заголовке. Код всех файлов привожу.

package.json

{
  "name": "nodejs",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "engines": {
    "node": "15.3.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node src/index.js",
    "start:dev": "nodemon",
    "clean": "rimraf build && mkdirp build",
    "build-babel": "babel -d ./build ./src -s --copy-files",
    "build": "npm run clean && npm run build-babel",
    "postinstall": "npm run build"
  },
  "repository": {
    "type": "git",
    "url": "git+https://[email protected]:mh_koval/nodejs.git"
  },
  "author": "Mykhayl Koval <[email protected]>",
  "license": "ISC",
  "bugs": {
    "url": "https://[email protected]:mh_koval/nodejs/issues"
  },
  "homepage": "https://[email protected]:mh_koval/nodejs#readme",
  "devDependencies": {
    "@babel/cli": "^7.10.3",
    "@babel/core": "^7.10.3",
    "@babel/node": "^7.10.3",
    "@babel/plugin-proposal-class-properties": "^7.10.4",
    "@babel/polyfill": "^7.12.1",
    "@babel/preset-env": "^7.10.3",
    "babel-loader": "^8.1.0",
    "mkdirp": "^0.5.5",
    "nodemon": "^2.0.4",
    "rimraf": "^3.0.2"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}

nodemon.json

{
  "watch": [
    "src",
    ".env"
  ],
  "ext": "js, json",
  "ignore": [
    "src/**/*.spec.ts"
  ],
  "exec": "babel-node ./src/index.js"
}

.babelrc

{
  "presets": [
    "@babel/preset-env"
  ],
  "plugins": [
    "@babel/plugin-proposal-class-properties"
  ],
  "ignore": []
}

Структура

введите сюда описание изображения

Ошибка

введите сюда описание изображения


Ответы (1 шт):

Автор решения: Aziz Umarov

Стандартное решение при проблемах с версиями это переустановка модулей. Удаление package-lock.json и node_modules и новая установка пакетов. попробуйте удалить глобально babel-core

I used the following to check global dependencies.

npm list -g --depth 0

Found a bable package and I removed it globally.

npm uninstall -g babel-core

Deleted my package-lock.json

Then reinstalled it locally

npm i --save-dev @babel/core

→ Ссылка