AWS Elastic Beanstalkl Nodejs React部署报错babel: command not found
AWS Elastic Beanstalkl Nodejs React Deployment Error babel: command not found
尝试在 elastic beanstalk 上启动 React 节点应用程序并遇到服务器端错误
我的文件夹设置是
-client
-server
- index.js
- other files etc
-package.json
在我的 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"
}
}
当 运行 eb 部署时,我得到错误
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
不确定如何解决这个问题,因为我的 package.json 已经包含了 babel 依赖项
此外,从其他在线教程中,我看到指南说明将 index.js 作为编译文件输出,并包含一个覆盖 npm start 并运行编译文件的 Procfile,但这种方法对我不起作用,因为我的服务器包含 10 个以上的文件。
"babel index.js --out-file index-compiled.js",
感谢任何帮助。谢谢
必须设置aws环境变量
NPM_USE_PRODUCTION = 假
安装开发依赖项
尝试在 elastic beanstalk 上启动 React 节点应用程序并遇到服务器端错误
我的文件夹设置是
-client
-server
- index.js
- other files etc
-package.json
在我的 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"
}
}
当 运行 eb 部署时,我得到错误
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
不确定如何解决这个问题,因为我的 package.json 已经包含了 babel 依赖项
此外,从其他在线教程中,我看到指南说明将 index.js 作为编译文件输出,并包含一个覆盖 npm start 并运行编译文件的 Procfile,但这种方法对我不起作用,因为我的服务器包含 10 个以上的文件。
"babel index.js --out-file index-compiled.js",
感谢任何帮助。谢谢
必须设置aws环境变量
NPM_USE_PRODUCTION = 假
安装开发依赖项