0

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.

4 Answers4

0

The command is sls offline

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

Msvstl
  • 1,116
  • 5
  • 21
  • Upvote if this solves your problem. – Msvstl Sep 16 '22 at 14:33
  • Thanks, but you can run `sls offline` or `serverless offline` as it says in the documentation. – Estefania Castro Vizoso Sep 20 '22 at 10:13
  • @EstefaniaCastroVizoso you ran `sls offline start` start is not present according to your question that's the issue. – Msvstl Sep 20 '22 at 10:24
  • Thanks @Msvstl, but I have also tried those options, `sls offline start`, `Serverless offline start`, the result is always the same 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.** – Estefania Castro Vizoso Sep 20 '22 at 10:32
  • @EstefaniaCastroVizoso is your issue resolved or not? did you try installing the plugin globally -g? – Msvstl Sep 20 '22 at 11:51
  • No, it is not resolved at all! And yes, I have tried all the things mentioned above – Estefania Castro Vizoso Sep 21 '22 at 09:50
  • @EstefaniaCastroVizoso can you run `sls offline` command and add error logs instead of images in the question. – Msvstl Sep 21 '22 at 10:01
  • Yes, I can (it is done), but the error is the one you see above. I don't know how to see more logs when I run that command. It is all I can see. – Estefania Castro Vizoso Sep 21 '22 at 10:32
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/248230/discussion-between-estefania-castro-vizoso-and-msvstl). – Estefania Castro Vizoso Sep 21 '22 at 13:18
0

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 :)

0

Make sure to add the below plugin on root folder

plugins:
  - serverless-offline
Aamer
  • 417
  • 3
  • 9
0

The issue is now resolved, the problem was the node version. Here it is the repo with the example https://github.com/EstefaniaExamples/NurseryApp