# Can't use env variables in the package.json file

**URL:** <https://answers.netlify.com/t/cant-use-env-variables-in-the-package-json-file/24579>\
**Category:** Support\
**Tags:** building, deployment\
**Created:** [October 17, 2020, 9:23am UTC](https://answers.netlify.com/t/cant-use-env-variables-in-the-package-json-file/24579 "2020-10-17T09:23:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![perry](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/perry/32/16_2.png) [@perry](https://answers.netlify.com/u/perry)\
**Post date:** [October 19, 2020, 8:14pm UTC](https://answers.netlify.com/t/cant-use-env-variables-in-the-package-json-file/24579/2 "2020-10-19T20:14:38Z")

</div>

hmm, not 100% sure this is quite the right thing, but maybe start here?

> [@\[Support Guide\] Using environment variables on Netlify correctly](https://answers.netlify.com/t/support-guide-using-environment-variables-on-netlify-correctly/267):
>
> Last reviewed: August 2023 The preferred way to use environment variables in Netlify is to set them in our environment - be that in the Environment Variables settings UI (on the site’s “Build & Deploy settings” page), or [via netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration/). You’ll want to choose the right pattern to meet your needs. Setting variables in our UI may be considered a bit more secure, since only people with access to the Netlify admin UI for your site can see them, rather than “anyone who can clone your repo!”. Thes…

---

_[View the full topic](https://answers.netlify.com/t/cant-use-env-variables-in-the-package-json-file/24579)._
