[AWS]Serverless plugin "serverless-offline"/"serverless-webpack" not found

Hi there,

I am trying to run my Serverless project through A CI pipeline on AWS.
I am developing APIs at the moment and we will be using 4 stages, TEST,DEV,STAGING,PRODUCTION
I deploy to TEST stage locally to try out new features etc - if satisfied I add to github which kicks off an AWS CodePipeline.

  • CodeBuild - in this stage I run Serverless package and then deploy to stage DEV

  • EC2 (staging) - once the build stage is complete, the artifact (.serverless,serverless.yml,package.json,appspec.yml(for EC2), and deploy.sh) is deployed to the EC2 instance(working) and then I run the deploy.sh script :
    `#!/bin/bash
    if [ “$DEPLOYMENT_GROUP_NAME” == “api-staging” ]
    then
    cd /var/www/api
    #get NVM
    # curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.0/install.sh | bash
    #Activate
    . ~/.nvm/nvm.sh
    #debug flag
    SLS_DEBUG=* sls

      sudo npm install
      sudo tar -xvjf api.tar.bz2
      serverless deploy --stage staging --package .serverless`
    

The error I’m getting is:
[stdout] Serverless plugin “serverless-webpack” not found. Make sure it’s installed and listed in the “plugins” section of your serverless config file.
the same happens for serverless-offline.

I manually SSH into my EC2 instance to see what was going on - ran command :
[ec2-user@ip-xxx-xxx-xxx api]$ serverless deploy --stage staging --package .serverless

which gave the same result - serverless-* not found.

I ran npm list :
`[ec2-user@ip-xxx-xxx-xxx api]$ npm list
choirpal-api@1.0.0 /var/www/api
├── UNMET DEPENDENCY async@^2.6.2
├── UNMET DEPENDENCY cors@^2.8.5
├── UNMET DEPENDENCY flywaydb-cli@^0.8.3
├── UNMET DEPENDENCY pg@^7.10.0
├── UNMET DEPENDENCY pg-pool@^2.0.6
├── UNMET DEPENDENCY serverless@^1.41.1
└── UNMET DEPENDENCY serverless-offline@^4.4.2

npm ERR! missing: async@^2.6.2, required by choirpal-api@1.0.0
npm ERR! missing: cors@^2.8.5, required by choirpal-api@1.0.0
npm ERR! missing: flywaydb-cli@^0.8.3, required by choirpal-api@1.0.0
npm ERR! missing: pg@^7.10.0, required by choirpal-api@1.0.0
npm ERR! missing: pg-pool@^2.0.6, required by choirpal-api@1.0.0
npm ERR! missing: serverless@^1.41.1, required by choirpal-api@1.0.0
npm ERR! missing: serverless-offline@^4.4.2, required by choirpal-api@1.0.0`

I have tried installing each package individually but the problem persists - any ideas?
I don’t know if this issue is Serverless, NPM, or EC2 related but I had to start somewhere :wink:

Thank you in advance for the help.

Apologies for poor formatting - first post.