I was trying to run a node.js project with serverless installed globally but I keep running into this error where it doesn't recognise the command.
Command:
sls offline start --stage dev --app serverless --port 4000 --basepath serverless
Error:
Environment: linux, node 16.13.2, framework 3.12.0, plugin 6.2.1, SDK 4.3.2
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
Error:
Serverless command "offline start" not found. Run "serverless help" for a list of all available commands.
I have installed the necessary plugins like serverless-offline
globally and as dev dependencies and they are in the plugins section of my serverless.yml
.
plugins:
- serverless-dotenv-plugin
- serverless-offline
- serverless-domain-manager
- serverless-plugin-include-dependencies
- serverless-aws-documentation
- serverless-plugin-warmup
All of the plugins are properly installed globally here after checking with npm list -g
npm list -g
/home/nero/.npm/lib
├── firebase-tools@10.1.4
├── npm-check-updates@12.2.1
├── npm@8.6.0
├── serverless-domain-manager@6.0.2
├── serverless-dotenv-plugin@3.12.2
├── serverless-offline@8.5.0
├── serverless-plugin-include-dependencies@5.0.0
├── serverless-plugin-warmup@7.1.0
└── serverless@3.12.0
Also may or may not be related, the sls --verbose
command suddenly thinks I want to create a new serverless project.
sls --verbose
Creating a new serverless project
? What do you want to make? (Use arrow keys)
❯ AWS - Node.js - Starter
AWS - Node.js - HTTP API
AWS - Node.js - Scheduled Task
AWS - Node.js - SQS Worker
AWS - Node.js - Express API
AWS - Node.js - Express API with DynamoDB
AWS - Python - Starter
AWS - Python - HTTP API
AWS - Python - Scheduled Task
AWS - Python - SQS Worker
AWS - Python - Flask API
AWS - Python - Flask API with DynamoDB
Other
Not quite sure what's going on here, maybe I messed up the installation somehow.