eb-fix-npm icon indicating copy to clipboard operation
eb-fix-npm copied to clipboard

Deployment broken

Open xurei opened this issue 6 years ago • 8 comments

When I try to deploy a new version of my app, I get this error from Elastic Beanstalk :

Command failed on instance. Return code: 1 
Output: ln: failed to create symbolic link ‘/tmp/deployment/application/node_modules’: File exists. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/46cache_node_modules.sh failed. 
For more detail, check /var/log/eb-activity.log using console or EB CLI.

Did I miss something ?

xurei avatar Dec 07 '17 16:12 xurei

Hm, it looks like the Elastic Beanstalk staging directory (/tmp/deployment/application/) is unclean for some reason. What version of the EB Node.js platform do you use and what are the contents of /opt/elasticbeanstalk/hooks/appdeploy/pre/ on one of your EC2 instances? I wonder if in a newer version of the EB platform, EB installs the node modules earlier than 50npm.sh.

Also if you run this script on a fresh EC2 instance (by terminating one of the instances in your application), does it work then?

wearhere avatar Dec 11 '17 23:12 wearhere

Platform version : 4.3.0 Content of directory (without eb-fix-npm) : 01_configure_xray.sh 10clean.sh 20unzip.sh 30config_clean.sh 40install_node.sh 50npm.sh 60config_generate.sh

It works the first time, yes. But if I try to update an existing instance it does not.

xurei avatar Dec 14 '17 15:12 xurei

Ok, my next move to debug this would be to check if, when you get the "/tmp/deployment/application/node_modules exists" error, /tmp/deployment/application/node_modules is a regular folder or already somehow is the symlink to /var/node_modules as initialized here. It might be that EB reuses the staging directory somehow on platform 4.3.0, and so that line needs to check whether the symlink exists already or not.

By the way, this module probably needs to be updated in other ways for platform 4.3.0. For instance, if you're using Node 8.x, thus npm 5, it might be that you no longer need to downgrade to npm 2 for speed reasons.

A disclaimer that's at the top of the README but I should repeat here: Mixmax no longer uses this module in favor of eb-disable-npm.

wearhere avatar Dec 14 '17 19:12 wearhere

@xurei @wearhere any update on the issue? having same trouble here

rkrasiuk avatar Jun 16 '18 23:06 rkrasiuk

ended up in a lot of EB pain.

d1manson avatar Jun 22 '18 11:06 d1manson

for anyone struggling, removing cached modules and setting up aws codepipeline helped

rkrasiuk avatar Jun 23 '18 10:06 rkrasiuk

@rkrasiuk could you please explain how to do this?

dblythy avatar Aug 14 '18 05:08 dblythy

@dblythy well, i couldn't get direct deployment to work, so i set up aws codepipeline - webhook for github -> aws codebuild -> deployment to eb. hope that helps you!

rkrasiuk avatar Aug 14 '18 08:08 rkrasiuk