Skip to content

Commit 7752924

Browse files
authored
Update README.md
1 parent 4b949ac commit 7752924

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Diff for: README.md

+11-5
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,22 @@ netlify-lambda install [folder]
6868

6969
Sometimes your function folders will have dependencies unique to them, managed by a package.json local to that folder. This is a small utility function for installing those dependencies either on your local machine or as part of your build commands.
7070

71-
By default it just runs on the functions folder specified in `netlify.toml`:
71+
By default it just runs on the functions folder specified in `netlify.toml`. Here's all you need to add to your `package.json` (see [this example](https://github.com/sw-yx/gatsby-netlify-form-example-v2/commit/f88462a4c37b5ddcdf5f394606ac14b58d6b475d#diff-b9cfc7f2cdf78a7f4b91a753d10865a2)):
7272

73-
```bash
74-
netlify-lambda install
73+
```js
74+
// package.json
75+
{
76+
"dependencies": { // you probably don't want it in devDependencies! This is a common gotcha https://www.netlify.com/docs/build-gotchas/#devdependencies
77+
"netlify-lambda": "^1.6.0"
78+
},
79+
"scripts": {
80+
"postinstall": "netlify-lambda install"
81+
},
82+
}
7583
```
7684

7785
This is what you should do if you are just using Netlify Dev without `netlify-lambda`.
7886

79-
> 💁Check [this commit](https://github.com/sw-yx/gatsby-netlify-form-example-v2/commit/f88462a4c37b5ddcdf5f394606ac14b58d6b475d#diff-b9cfc7f2cdf78a7f4b91a753d10865a2) for an example of how to add `netlify-lambda install` in just two lines to fix your functions install issues. **Make sure it is in dependencies not devDependencies**. This is a [common gotcha](https://www.netlify.com/docs/build-gotchas/#devdependencies).
80-
8187
If you're using `netlify-lambda serve` or `build`, however, you will want to run this install on the _source_ folder rather than the _dist_/netlify.toml functions folder, so you should run it with the same exact folder name as with those other commands:
8288

8389
```bash

0 commit comments

Comments
 (0)