gpt4 book ai didi

node.js - Amazon Elastic Beanstalk npm 找不到 package.json

转载 作者:IT老高 更新时间:2023-10-28 23:00:48 27 4
gpt4 key购买 nike

我对亚马逊网络服务非常陌生,我正在尝试在他们的弹性 beanstalk 上设置一个 node.js 应用程序。我设置了实例并上传/部署了站点,但是当运行状况“正常”时,node.js 日志显示这重复了大约 30 次:

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

{
"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] 看来(这是我的问题)您可能正在压缩顶级目录而不是压缩源本身。

例如,您可能将所有文件放在一个名为“Project”的文件夹中。与其压缩“Project”,不如压缩并上传“Project”的内容

[1] https://forums.aws.amazon.com/thread.jspa?messageID=476022

关于node.js - Amazon Elastic Beanstalk npm 找不到 package.json,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35387822/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com