2

I have a boiler template saved in my local. How do I create a template using it? I tried the below command, but it did not work:

serverless create --template-path '.\Boiler plate\' --name UserRegistration

I got the following error:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:120:11)
at Object.join (path.js:375:7).....
.........

None of the solutions I find online worked for me.

Gaurav Thantry
  • 103
  • 1
  • 13

1 Answers1

1

The error says the serverless command argument path is undefined. On the serverless create documentation page, there is an example listed that says:

serverless create --template-path path/to/my/template/folder --path path/to/my/service --name my-new-service

This will copy the path/to/my/template/folder folder into path/to/my/service and rename the service to my-new-service.

In order to solve your problem, you need to provide a valid template-path pointing to a local Serverless template and provide a 'target path' using --path to which your template will be copied. So you command will probably look like this:

serverless create --template-path '.\Boiler plate' --path /target/for/your/template.yml --name UserRegistration

Note: I haven't adjusted '.\Boiler plate\' in this command. Are you sure it's correct using a backslash \ after . ?

s.hesse
  • 1,900
  • 10
  • 13
  • Hi @hesse. Thank you for your reply.Yes, the slash may or may not be used. I am getting the folowwing error when I am trying to run `serverless create --template-path '.Boiler plate' --path './CompanyRegistration/serverless.yml' --name CompanyRegistration` Error: `error TS2307: Cannot find module 'serverless/aws' or its corresponding type declarations.` – Gaurav Thantry Sep 22 '20 at 04:37
  • Got it. I didn't know I had to run the serverless create from inside the boiler plate – Gaurav Thantry Sep 22 '20 at 05:26