Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Elastic Beanstalk npm cant find package.json

Tags:

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 

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" } 
like image 803
user3281826 Avatar asked Feb 14 '16 02:02

user3281826


People also ask

Where is my package json file?

The package. json file is normally located at the root directory of a Node. js project. The name field should explain itself: this is the name of your project.

How do I specify Nodejs in package json?

Use the engines keyword in the package. json file to specify the Node. js version that you want your application to use. You can also specify a version range using npm notation.


1 Answers

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.

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

like image 200
another_user10293412 Avatar answered Sep 19 '22 19:09

another_user10293412