简体   繁体   English

AWS Elastic Beanstalkl Nodejs React部署报错babel: command not found

[英]AWS Elastic Beanstalkl Nodejs React Deployment Error babel: command not found

trying to launch a react node app on elastic beanstalk and experience server side errors尝试在弹性 beantalk 上启动反应节点应用程序并遇到服务器端错误

my folder set up is我的文件夹设置是

-client
-server
  - index.js
  - other files etc
-package.json

inside my package.json, my scripts are listed as在我的 package.json 中,我的脚本列为

{

  "version": "0.0.0",
  "main": "dist/index.js",
  "scripts": {
    "clean": "rm -rf build && mkdir build",
    "build-server": "babel -d ./build ./server -s",
    "build": "npm run clean && npm run build-server",
    "start": "npm run build && node ./build/index.js",
  },
  "dependencies": {
    "@babel/runtime": "^7.9.2",
  },
  "devDependencies": {
    "@babel/cli": "^7.5.5",
    "@babel/core": "^7.5.5",
    "@babel/node": "^7.5.5",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-proposal-decorators": "^7.4.4",
    "@babel/plugin-transform-runtime": "^7.9.0",
    "@babel/preset-env": "^7.5.5",
    "@babel/preset-react": "^7.0.0",
    "babel-eslint": "^10.0.2",
    "babel-loader": "^8.0.6",
    "nodemon": "^2.0.7"
  }
}

when running eb deploy, i get errors运行 eb deploy 时出现错误

Jan 28 04:51:45 web: > api@0.0.0 start /var/app/current
Jan 28 04:51:45 web: > npm run build && node ./build/index.js
Jan 28 04:51:45 web: > api@0.0.0 build /var/app/current
Jan 28 04:51:45 web: > npm run clean && npm run build-server
Jan 28 04:51:45 web: > api@0.0.0 clean /var/app/current
Jan 28 04:51:45 web: > rm -rf build && mkdir build
Jan 28 04:51:45 web: > api@0.0.0 build-server /var/app/current
Jan 28 04:51:45 web: > babel -d ./build ./server -s
Jan 28 04:51:45 web: sh: babel: command not found

Not sure how to fix this as my package.json already includes babel dependencies不确定如何解决这个问题,因为我的 package.json 已经包含 babel 依赖项

Also, from other online tutorials, I see guides stating to output index.js as a compiled file and including a Procfile which overrides npm start and runs the compiled file, but this approach doesnt work for me as my server includes 10+ files.此外,从其他在线教程中,我看到指南将 output index.js 声明为编译文件,并包括一个覆盖 npm 的 Procfile 启动并运行编译文件,但这种方法对我不起作用,因为我的服务器包含 10 多个文件。

"babel index.js --out-file index-compiled.js",

any help appreciated.任何帮助表示赞赏。 thanks谢谢

have to set aws environment variable必须设置aws环境变量

NPM_USE_PRODUCTION = false NPM_USE_PRODUCTION = 假

to install dev dependencies安装开发依赖

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM