Got the error: This command can only be run in a Serverless service directory

I am following the instructions at https://serverless.com/learn/quick-start/:

  • Installed serverless CLI
  • Created the AWS account and serverless-admin user on IAM page
  • Using Quick Setup tried to set my AWS API Key & Secret

This last action in that sequence (serverless deploy) failed with the message

This command can only be run in a Serverless service directory

My question: what constitutes a Serverless service directory? I could not have done anything with the serverless CLI so far as your guides did not require that yet (it seems that I am in a catch 22 situation)

Note: my environment information is

  Your Environment Information -----------------------------
     OS:                     win32
     Node Version:           8.9.4
     Serverless Version:     1.26.1

and I am using cmder.exe as my “shell”

you need cd to the folder where has the file serverless.yml, that’s the deploy command complain for.

For example,

sls create --template aws-nodejs --path myService
cd myService
sls deploy

Thank you @bill - seeing this now, I am surprised that I felt the need to ask this question :wink:

Hi,
I receive this error when using the serverless-python-requirement plugin and i do not have a file named serverless.yml, but two files: serverlessA.yml and serverlessB.yml.

then I try to execute:

  • serverless --config serverlessA.yml and
  • serverless --config serverlessb.yml

is the --config creating some weird folder structure behind the scene?

thanks,
M