无法使用 babel 运行 Nodemon

Unable to run Nodemon with babel

在运行ning npm 运行 dev 之后,我得到以下错误:

    > sistema@1.0.0 dev
    > nodemon index.js --exec babel-node
    
    [nodemon] 1.18.9
    [nodemon] to restart at any time, enter `rs`
    [nodemon] watching: *.*
    [nodemon] starting `babel-node index.js`
    (node:20560) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
    (Use `node --trace-warnings ...` to show where the warning was created)
    C:\Users\elvis\Documents\Proyecto Express\sistema\index.js:1
    import express from 'express'; //const express=require('express');
    ^^^^^^
    
    SyntaxError: Cannot use import statement outside a module
        at wrapSafe (internal/modules/cjs/loader.js:984:16)
        at Module._compile (internal/modules/cjs/loader.js:1032:27)
        at Module._compile (C:\Users\elvis\AppData\Roaming\npm\node_modules\@babel\node\node_modules\pirates\lib\index.js:136:24)
        at Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
        at Object.newLoader [as .js] (C:\Users\elvis\AppData\Roaming\npm\node_modules\@babel\node\node_modules\pirates\lib\index.js:141:7)
        at Module.load (internal/modules/cjs/loader.js:933:32)
        at Function.Module._load (internal/modules/cjs/loader.js:774:14)
        at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
        at Object.<anonymous> (C:\Users\elvis\AppData\Roaming\npm\node_modules\@babel\node\lib\_babel-node.js:176:21)
        at Module._compile (internal/modules/cjs/loader.js:1068:30)
    [nodemon] app crashed - waiting for file changes before starting...

我已经尝试了所有可能的解决方案:

这是我的package.json文件:

{
  "name": "sistema",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "dev": "nodemon index.js --exec babel-node"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-3": "^6.24.1",
    "bcryptjs": "^2.4.3",
    "cors": "^2.8.5",
    "express": "^4.16.4",
    "express-promise-router": "^3.0.3",
    "jsonwebtoken": "^8.5.0",
    "mongoose": "^5.4.10",
    "morgan": "^1.9.1"
  },
  "devDependencies": {
    "nodemon": "^1.18.9"
  }
}

这是我的 .babelrc 文件:

{
    "presets": [

      //"env" ,
      //"stage-3"
    ]
}

有人能给我一些帮助或建议吗?

谢谢,

我通过 npm install 安装 babel 解决了这个问题 babel-cli babel-core --save-dev