Created
          June 18, 2018 23:50 
        
      - 
      
- 
        Save cooperka/0960c0652353923883db15b4b8fc8ba5 to your computer and use it in GitHub Desktop. 
    AWS Elastic Beanstalk - Replace npm with yarn
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # .ebextensions/01_install_yarn.config | |
| files: | |
| '/opt/elasticbeanstalk/hooks/appdeploy/pre/49install_yarn.sh' : | |
| mode: '000755' | |
| owner: root | |
| group: root | |
| content: | | |
| #!/usr/bin/env bash | |
| set -euxo pipefail | |
| EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir) | |
| if node -v; then | |
| echo 'Node already installed.' | |
| else | |
| echo 'Installing node...' | |
| curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - | |
| yum -y install nodejs | |
| fi | |
| if yarn -v; then | |
| echo 'Yarn already installed.' | |
| else | |
| echo 'Installing yarn...' | |
| wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo | |
| yum -y install yarn | |
| fi | |
| '/opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh' : | |
| mode: '000755' | |
| owner: root | |
| group: root | |
| content: | | |
| #!/usr/bin/env bash | |
| set -euxo pipefail | |
| yarn install | 
make sure you add the correct version:
sudo curl --silent --location https://rpm.nodesource.com/setup_{version_number}.x | sudo bash -
for permission, git update-index --chmod=+x path/to/file
2 things I would like to add:
- after git update-indexcommand, you only have togit commit
- touching /path/to/fileis always resetting the permission for me from100755 => 100644. So I have to make sure I run update-index command again
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
https://stackoverflow.com/questions/40978921/how-to-add-chmod-permissions-to-file-in-git