0

Description problem

I have a problem with serverless-offline because I try to install this local and global, and it doesn't work.

serverless-offline image error

When executing the command I get this information
sls offline

Serverless command "offline" not found. Run "serverless help" for a list of all available commands.

This is my configuration in the serverless file.

provider:
  name: aws
  runtime: nodejs14.x
  environment:
    NODE_ENV: ${env:NODE_ENV}

plugins:
  - serverless-plugin-typescript
  - serverless-offline

This commands I used to install

In the machine environment

npm i -g serverless-offline

In the file project:

yarn add serverless-offline -D

Issue in git

Serverles environment configurated image

1 Answers1

1

Try in your project with the npx prefix. So npx sls offline or npx serverless offline.

Robert-Jan Kuyper
  • 2,418
  • 12
  • 22
  • Thanks for your idea, but it has not worked. :+1: –  Nov 10 '21 at 18:50
  • Make sure serverless-offline is installed in your project as well via `npm i serverless-offline` or `npm i -g serverless-offline`. That counts for all plugins. More similar issues at: https://stackoverflow.com/questions/63507149/serverless-command-offline-not-found – Robert-Jan Kuyper Nov 10 '21 at 19:30
  • I already fixed it; I have nvm on my computer, so I installed serverless on the latest version of the node, and I also had the need to install ```serverless-plugin-optimize``` because then this error jumped: ```Serverless: To ensure safe major version updates, make sure to set "framework version" in the service settings (recommended setting: "framework version: ^ 2.66.1").``` I don't know why but I execute: ```serverless offline``` and worked. I think there is not a good solution, but it's working. –  Nov 10 '21 at 22:13
  • I tried many solutions but this did work for me. Thank you – Rutvi Trivedi May 31 '22 at 12:21