将MERN应用部署到Heroku时,如何解决“ babel:not found”和“找不到模块'./common”?

时间:2019-09-06 21:46:14

标签: node.js heroku mern

尝试在Heroku中部署MERN堆栈应用程序,并在日志中提到找不到Babel和模块“ ./common”

在尝试部署之前,我已经运行过npm install,已经删除了Babel的所有版本6实例以升级到版本7,并且也重新配置了构建脚本。

Package.json-脚本:

bool

Package.json-依赖项:

"scripts": {
    "start": "npm run build && node dist/index.js",
    "serve": "node dist/index.js",
    "build": "babel ./src/index.js -d dist",
    "heroku-postbuild": "cd front-end && npm install --only=dev && npm install && npm run build"
  },

Heroku日志:

"dependencies": {
    "@babel/cli": "^7.6.0",
    "@babel/core": "^7.6.0",
    "@babel/preset-env": "^7.6.0",
    "@babel/register": "^7.6.0",
    "@elastic/elasticsearch": "^7.2.0",
    "aws-sdk": "^2.518.0",
    "aws4": "^1.8.0",
    "axios": "^0.19.0",
    "bcryptjs": "^2.4.3",
    "body-parser": "^1.18.3",
    "cheerio": "^1.0.0-rc.3",
    "common": "^0.2.5",
    "connect-mongo": "^2.0.2",
    "cookie-parser": "^1.4.3",
    "cors": "^2.8.4",
    "dotenv": "^7.0.0",
    "elasticsearch": "^16.3.0",
    "express": "^4.16.3",
    "express-session": "^1.15.6",
    "express-validator": "^5.3.1",
    "helmet": "^3.18.0",
    "http-aws-es": "^6.0.0",
    "install": "^0.13.0",
    "jsonwebtoken": "^8.5.1",
    "lodash": "^4.17.11",
    "mongoosastic": "^4.5.0",
    "mongoose": "^5.3.4",
    "morgan": "^1.9.1",
    "multer": "^1.4.1",
    "node-mailjet": "^3.3.1",
    "node-pre-gyp": "^0.13.0",
    "passport": "^0.4.0",
    "passport-custom": "^1.0.5",
    "passport-jwt": "^4.0.0",
    "passport.socketio": "^3.7.0",
    "request": "^2.88.0",
    "request-promise": "^4.2.4",
    "socket.io": "^2.2.0",
    "socket.io-redis": "^5.2.0",
    "stripe": "^6.25.1",
    "swagger": "^0.7.5",
    "swagger-ui-express": "^4.0.2",
    "sync-request": "^6.1.0",
    "validator": "^10.8.0",
    "winston": "^3.1.0",
    "xss": "^1.0.3"
  },
  "devDependencies": {
    "nodemon": "^1.18.4"
  }

0 个答案:

没有答案