# Plugins don't work when installed globally?

**URL:** <https://forum.serverless.com/t/plugins-dont-work-when-installed-globally/5874>\
**Category:** Serverless Framework\
**Created:** [September 19, 2018, 12:12pm UTC](https://forum.serverless.com/t/plugins-dont-work-when-installed-globally/5874 "2018-09-19T12:12:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivokund](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/ivokund/32/2562_2.png) [@ivokund](https://forum.serverless.com/u/ivokund)\
**Post date:** [September 19, 2018, 12:12pm UTC](https://forum.serverless.com/t/plugins-dont-work-when-installed-globally/5874/1 "2018-09-19T12:12:16Z")

</div>

I’m a bit confused by these two facts:

- serverless is usually installed and works fine as a global npm package
- serverless plugins need to be installed locally and do not work when installed with `-g` flag (see [https://github.com/amplify-education/serverless-domain-manager/issues/162](https://github.com/amplify-education/serverless-domain-manager/issues/162))

Also see: [https://github.com/serverless/serverless/issues/3319](https://github.com/serverless/serverless/issues/3319)

I’m absolutelly fine with defining my plugins in serverless.yml, but as I’m not using nodejs in my project at all, having a package.json and node\_modules in my local installation just to be able to run a serverless plugin seems a bit unnecessary.

Is there any particular reason why plugins should not work when installed globally?  
Thanks for any clarification.

---

<div class="post-metadata">

**Author:** ![buggy](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/buggy/32/177_2.png) [@buggy](https://forum.serverless.com/u/buggy)\
**Post date:** [September 30, 2018, 8:07am UTC](https://forum.serverless.com/t/plugins-dont-work-when-installed-globally/5874/2 "2018-09-30T08:07:16Z")

</div>

You can exclude the package.json and node\_modules from your package using the [package exclude](https://serverless.com/framework/docs/providers/aws/guide/packaging/#exclude--include) option in your serverless.yml.

Personally, I install everything locally so each service is using the correct version of Serverless.

---

<div class="post-metadata">

**Author:** ![monigala](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.serverless.com/monigala/32/6962_2.png) [@monigala](https://forum.serverless.com/u/monigala)\
**Post date:** [July 21, 2022, 6:20pm UTC](https://forum.serverless.com/t/plugins-dont-work-when-installed-globally/5874/3 "2022-07-21T18:20:56Z")

</div>

Installing locally isn’t a great solution. If you use lambda layers for node\_modules then you’ll almost certainly run into this:

Unzipped size must be smaller than 262144000 bytes (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ; Proxy: null)
