'Npm build failing through AWS pipline i.e appspec.yml but working if manually run
I have a react application and ser up my codepipeline The appspecfile is as such
version: 0.0
os: linux
files:
- source: aalekh
destination: /home/ubuntu/Aalekh/aalekh
hooks:
BeforeInstall:
- location: aalekh/beforeinstall.sh
AfterInstall:
- location: aalekh/afterinstall.sh
ApplicationStart:
ValidateService:
The afterinstall file fails.The file is :-
#!/bin/bash -e
log=log_file.txt
echo "Running Audit Fix" >> log
sudo npm audit fix >>log
echo "Audit Fix Done " >> log
echo "Installing Dependencies " >> log
sudo npm install >>log
echo "Dependencies Installed" >> log
echo "Starting Build " >> log
sudo npm run build >>log
echo "Build Done " >> log
sudo service apache2 restart
In this, the build always fails to say that either the application ran out of memory or someone killed the process
But when I ssh the process and manually run this file as
sudo sh afterinstall.sh
The build is successful Can someone help me with this
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
