Skip to content

Errors / JavaScript errors

Uncaught ReferenceError: process is not defined

Code written for a server ran in the visitor's browser, where that part does not exist.

The script, often the whole app bundle, stops on load: a blank page.

Why it happens

  • A dependency reads process.env and the bundler no longer fills it in: webpack 5 and Vite stopped adding Node's globals for the browser.
  • App code reading process.env.SOMETHING in Vite, where it is import.meta.env instead.

How to fix it

  1. In Vite, use import.meta.env.VITE_…, or define: { "process.env": {} } for a library that only reads it.
  2. In webpack 5, DefinePlugin for the values that are read, or ProvidePlugin with the process/browser package.
  3. Check the library for a browser build before shimming it.

Whose problem it is

Usually the site's own code or settings.

Does your site have it?

Free, no account. We open your page and four more in a clean Chrome and list every error like this one, with the page and the click that caused it. How the free page check works.

Check only sites you run or have permission to check.

Often seen with

  • require is not definedA file written for a server's module system was sent to the browser as it is.
  • x is not definedA script used a name nobody declared, usually because another script it depends on did not load first.