Serverless - offline plugin

Viewed 36

I have a project in Node16 where I am trying to use Serverless-offline plugin. But I do not know how to make it work.

This is how I set up the plugin in the serverless.yml file:

Serverles.yml plugin section

And these are the ways I tried to run to install the plugin:

npm install serverless-offline --save-dev

serverless plugin install -n serverless-offline

However, every time I try to run sls offline start I get the same error:

enter image description here

 $ sls offline start    
Running "serverless" from node_modules
Environment: darwin, node 12.13.1, framework 3.22.0 (local) 3.22.0v (global), plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Serverless plugin "serverless-offline" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file. Run "serverless plugin install -n serverless-offline" to install it.

Also, if I run a npm list -g I can see the plugin is installed:

enter image description here

What's going on? What am I missing? This is the gitHub url https://github.com/EstefaniaExamples/NursertApp/tree/main/children-api

Thanks for your help in advance.

2 Answers

The command is sls offline

You can check this link to know more details about it.

It is working now, the problem was the node version (I was using node 12). After updating it (brew upgrade node) to node 18, the sls offline command worked as a charm :)

Related