0

So i am building a spring boot app with angular 4 front end and i need to automate the build and i am using AWS developer suite for that

i already created the pipeline that watch my repo changes and i have this buildspec.yml with following configuration

version: 0.2

phases:
  install:
    commands:
     - sudo apt-add-repository ppa:chris-lea/node.js
     - sudo apt-get -y update
     - sudo apt-get -y install nodejs=7.9.0
     - node -v
     - sudo npm install -g @angular/cli
  pre_build:
   commands:
     - sudo cd src/main/frontend
     - sudo npm install && sudo npm run deploy-dev
     - sudo cd .. && sudo cd .. && sudo cd..
  build:
   commands:
    - echo Build started on `date`
    - mvn clean install
 post_build:
   commands:
    - mv target/ROOT.war.original ROOT.war
artifacts:
  files:
    - '**/*'
  base-directory: 'target/ROOT'

and it's basically install nodejs and then install angular-cli to build Angular 4 after that move all dist/* to /resources/public in the spring boot and then run maven build.

my problem is I couldn't install node i tried many ways none of them worked for me , can any one help me with a second eye or have any experience with this ?

my build environment for AWS codebuild is Java8

Shadi
  • 173
  • 2
  • 9

1 Answers1

0

Well , i ended up installing nodejs v7.0.0 through bash script

i used below script

    set -ex \
        && for key in \
          9554F04D7259F04124DE6B476D5A82AC7E37093B \
          94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
          0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 \
          FD3A5288F042B6850C66B31F09FE44734EB7990E \
          71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
          DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
          B9AE9905FFD7803F25714661B63B535A4C206CA9 \
          C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
        ; do \
          gpg --keyserver ha.pool.sks-keyservers.net --recv-keys"$key"; \
        done


        sudo apt-get update

       wget "https://nodejs.org/download/release/v7.0.0/node-v7.0.0-linux-
       x64.tar.gz" -O node-v7.0.0-linux-x64.tar.gz \
        && wget "https://nodejs.org/download/release/v7.0.0/SHASUMS256.txt.asc" -O SHASUMS256.txt.asc \
        && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
        && grep " node-v7.0.0-linux-x64.tar.gz\$" SHASUMS256.txt | sha256sum -c - \
        && tar -xzf "node-v7.0.0-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
        && rm "node-v7.0.0-linux-x64.tar.gz" SHASUMS256.txt.asc SHASUMS256.txt \
        && ln -s /usr/local/bin/node /usr/local/bin/nodejs \
        && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*

basically this script will download and install nodejs v7.0.0 for you

which i took it from here

Hi , future struggler i left some dessert for you 3>

Shadi
  • 173
  • 2
  • 9