如何在AWS中部署node.js应用程序

Mah*_*ari 6 amazon-web-services node.js sails.js

当我尝试在AWS中部署我的新node.js应用程序时,我收到了一个错误

Failed to find package.json. Node.js may have issues starting. Verify package.json is valid or place code in a file named server.js or app.js.
Run Code Online (Sandbox Code Playgroud)

我已经验证了我的package.json,它显示为true.

我的package.json文件如下:

{
"name": "sgcp",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"dependencies": {
    "sails": "0.9.7",
    "nodemailer": "~0.6.1",
    "grunt": "0.4.1",
    "sails-disk": "~0.9.0",
    "ejs": "0.8.4",
    "optimist": "0.3.4",
    "sails-mongo": "~0.9.7"
},
"scripts": {
    "start": "node app.js",
    "debug": "node debug app.js"
},
"main": "app.js",
"repository": "git@github.com:xteam/xcp.git",
"author": "sg",
"license": "Proprietory",
"engines": {
    "node": "0.10.x"
}
}
Run Code Online (Sandbox Code Playgroud)

任何帮助表示赞赏.非常感谢.

小智 9

通过zip文件夹上传到AWS时,我发现AWS上的这个主题非常有用:https://forums.aws.amazon.com/thread.jspa?threadID = 130140&tstart = 0

基本上确保您压缩项目中的所有内容,而不是包含项目的文件夹.zip文件应直接包含app.js/server.js和package.json,而不是包含这些文件的文件夹.