Amazon Elastic Beanstalk npm无法找到package.json [英] Amazon Elastic Beanstalk npm cant find package.json
问题描述
我对亚马逊网络服务非常陌生,我正在尝试在其弹性beantalk上设置一个node.js应用。我设置了实例并上传/部署了站点,但是当运行状况为 Ok时,node.js日志显示此操作重复了大约30次:
I'm very new with amazon web services, and I am trying to set up a node.js app on their elastic beanstalk. I set up the instance and uploaded/deployed the site, but while the health is "Ok" the node.js logs show this repeated about 30 times:
npm ERR! enoent ENOENT: no such file or directory, open '/var/app/current/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /var/app/current/npm-debug.log
npm ERR! Linux 4.1.13-19.31.amzn1.x86_64
npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.2.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.2.3-linux-x64/bin/npm" "start"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! path /var/app/current/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
问题是我的package.json确实存在,因为我使用npm init生成了一个。为什么找不到它的任何想法?这是package.json
The problem is that my package.json does exist because I generated one with npm init. Any ideas on why it cant be found? Here is the package.json
{
"name": "testwebsite",
"version": "0.0.1",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "^1.13.3",
"express": "^4.13.3",
"express-session": "~1.0.0",
"socket.io": "^1.3.7"
},
"description": "my website",
"author": "Matt",
"engines": {
"node": ">=0.10.0"
},
"main": "server.js",
"devDependencies": {},
"license": "ISC"
}
推荐答案
从一个正式的AWS线程[1],似乎(这是我的问题)您可能是在压缩顶级目录,而不是在压缩源本身。
From an official AWS thread[1], it appears (and this was my problem) that you might be zipping the top-level directory rather than zipping the source itself.
例如,您可能将所有文件放在一个名为 Project的文件夹中。而不是压缩 Project,您应该压缩并上传 Project的 内容 。
For example, you may have all of your files in a folder called "Project". Rather than zipping "Project", you should zip and upload the contents of "Project".
[1 ] https://forums.aws.amazon.com/thread.jspa?messageID= 476022
这篇关于Amazon Elastic Beanstalk npm无法找到package.json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!