serverless: CLI can't work with existing project without node_modules
I have created a serverless project for python on AWS, which works fine… until I try to re-use the project directly after checkout. Any CLI command exits with the following error:
sls help
Serverless Error ---------------------------------------
Serverless plugin "serverless-python-requirements" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.16.1
Framework Version: 1.67.3 (standalone)
Plugin Version: 3.6.6
SDK Version: 2.3.0
Components Version: 2.29.0
I installed Serverless with the method “Install as a standalone binary”. The node_modules folder wasn’t checked in, but package.json and package-lock.json are versioned with serverless.yml, and the plugin is also present in serverless.yml. Is this a bug, or am I missing some initialization step?
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 17 (9 by maintainers)
I see, yes indeed there’s no method that will just install all plugin dependencies for an existing service. Interestingly it’s covered when you set up a new project via the
serverlesscommand and choose one of the existing templates.I guess
sls installcould do it, if we makeurloption as optional WDYT @pgrzesik @mnapoli ?The error you’re getting is because serverless is trying to find serverless-python-requirements in your node_modules but it isn’t there.
When you checkout, none of your dependencies are installed in the folder. The
slsfunction isn’t responsible for installing your dependencies. You need to re-install them by runningnpm installonce so thatslscan use your dependencies.This is standard for all NodeJS projects, when you clone or checkout a branch you should npm install so that the dependencies are downloaded into node_modules.