I am using Codeship as my CI tool, I integrate it with AWS CodeDeploy service. The procedure is perfect until my appspec.yml file calls my script to run the node app. Even though I have npm, node, bower and grunt installed I get command not found errors.
Asked
Active
Viewed 1,560 times
3 Answers
0
I would try editing your start_server.sh and adding npm and node to the $PATH environment variable or put that path directly in the command itself.
So instead of
npm install
Try
/usr/local/bin/npm install
That might not be where your npm lives but if you need to find out just do which npm

enderv
- 203
- 1
- 2
- 7
-
Well that was one of my many attempts to fix the issue. But even with the path I got the same error – Orane Findley Jan 30 '16 at 19:38
-
Are you doing the path change in the same start_server.sh script? – enderv Jan 31 '16 at 20:26
-
Yes I found the path with 'which' and made the changes in start_server.sh script – Orane Findley Jan 31 '16 at 21:22
-
Can you post the whole script? – enderv Jan 31 '16 at 21:57
-
Well man sorry then. They only other thing I can think of to check is what user the script is running as and make sure path lines up for that as well. – enderv Feb 03 '16 at 01:27
-
I already check that by running the "whoami" command in the script. – Orane Findley Feb 08 '16 at 17:08
0
Perform the below steps:
- which node
- sudo ln -s /home/ubuntu/.nvm/versions/node/v12.13.1/bin/node (output of above step) /usr/bin/node
- which npm
- sudo ln -s /home/ubuntu/.nvm/versions/node/v12.13.1/bin/npm (output of above step) /usr/bin/npm
and try to use it via /usr/bin/npm install
I hope this will help you!!

Harsh Patel
- 446
- 5
- 8
0
For people who still might run into the same problem.
Check your appspec.yml file and look at the destination, it should contain something like /home/ec2-user....
in this case we need to make sure code deploy agent runs with that user profile (ec2-user). Check this link for steps to to make code deploy to run with your user profile

Rustam Goygov
- 61
- 3