Serverless plugin not found even though it is installed and listed

aws

#1

Hi,

I’m trying to run sls deploy and I’m getting the following error:

  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
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           5.3.0
     Serverless Version:     1.19.0

As the error says I have checked to make sure the plugin is installed. I’ve deleted and re-run npm install with

`"serverless-python-requirements": "^2.5.0",`

listed in my package.json file.

My serverless.yml file includes

plugins:
  - serverless-python-requirements


provider:
  name: aws
  runtime: python3.6

My co-worker is able to run sls deploy when he pulls my most recent code. Am I missing something in my setup?


#2

Hey @Cael6, in your service directory, can you run npm list | grep serverless-python-requirements?

If it’s installed correctly, it should look something like this:

$ npm list | grep serverless-python-requirements
└─┬ serverless-python-requirements@2.5.0

If it’s not installed, you’ll get a bunch of output about missing packages.

If that doesn’t work, we can try something else.


#3

That is exactly what I got:

$ npm list | grep serverless-python-requirements
├─┬ serverless-python-requirements@2.5.0

#4

Hmm. In your service directory, can you drop into a Node REPL and see if you can load the plugin?

Run the following commands:

$ node
> require('serverless-python-requirements');
[Function: ServerlessPythonRequirements] # <--- Should see this if successful

Error: Cannot find module 'serverless-python-requirements' # <--- Will see this if unsuccessful

#5

Here’s what I got:

$ node
> require('serverless-python-requirements');
/path/to/node_modules/serverless-python-requirements/index.js:8
const {spawnSync} = require('child_process');
      ^
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:252:27)
    at bound (domain.js:287:14)

#6

It looks like I needed to be running node v6+. Thanks for your help @alexdebrie1


#7

I have the same problem with the serverless-client-s3 plugin.

$ npm list  | grep serverless-client-s3
└─┬ serverless-client-s3@2.0.0

$ node
> require('serverless-client-s3');
[Function]

 $ sls
 
  Serverless Error ---------------------------------------
 
  Serverless plugin "serverless-client-s3" not found. Make sure it's installed and listed in the "plugins" section of your serverless config file.
 [...]     
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           6.11.0
     Serverless Version:     1.20.2

I have used both npm and yarn. Could this be the problem?


#8

@paolini If you turn on debug mode, it will show more context around why the plugin isn’t loading.

$ SLS_DEBUG=* sls

That should throw the actual error for the plugin.


#9
> SLS_DEBUG=* sls
 
  Type Error ---------------------------------------------
 
  S.getServerlessPath is not a function
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
TypeError: S.getServerlessPath is not a function
    at new module.exports (/Users/paolini/notes/node_modules/serverless-client-s3/index.js:5:30)
    at PluginManager.addPlugin (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/classes/PluginManager.js:34:28)
    at plugins.forEach (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/classes/PluginManager.js:72:14)
    at Array.forEach (native)
    at PluginManager.loadPlugins (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/classes/PluginManager.js:68:13)
    at PluginManager.loadServicePlugins (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/classes/PluginManager.js:114:10)
    at PluginManager.loadAllPlugins (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/classes/PluginManager.js:64:10)
    at service.load.then (/Users/paolini/.config/yarn/global/node_modules/serverless/lib/Serverless.js:64:28)
From previous event:
    at runCallback (timers.js:651:20)
    at tryOnImmediate (timers.js:624:5)
    at processImmediate [as _immediateCallback] (timers.js:596:5)
From previous event:
    at __dirname (/Users/paolini/.config/yarn/global/node_modules/serverless/bin/serverless:25:46)
    at Object.<anonymous> (/Users/paolini/.config/yarn/global/node_modules/serverless/bin/serverless:43:4)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:418:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:533:3

#10

@paolini Looks like there was a compatibility issue with pre-1.0 versions of the Framework and 1.0+ versions. That was fixed in a PR, but a new release wasn’t published to NPM because the credentials are lost – see here.

Fortunately, someone forked the project into serverless-finch which has the latest updates. :tada: I would recommend using that instead of serverless-client-s3.