# ReferenceError: define is not defined on admin page

**URL:** <https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214>\
**Category:** Developer help\
**Created:** [January 7, 2020, 12:28pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214 "2020-01-07T12:28:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![koldLight](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/koldlight/32/5733_2.png) [@koldLight](https://forum.ghost.org/u/koldLight)\
**Post date:** [January 7, 2020, 12:28pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/1 "2020-01-07T12:28:12Z")

</div>

I can’t get into admin page. On the browser console I get the error:

```auto
Uncaught ReferenceError: define is not defined

```

### To Reproduce

Get with the browser on [https://blog.csimadroom.com/ghost/](https://blog.csimadroom.com/ghost/) .

It could be caused during a version upgrade. I was using ghost v1 and I upgraded ghost-cli and ghost to last versions (in that moment, 3.0.0). After that, I could access _sometimes_ to the admin page. I guess it can be caused because something in the cache expired or a synchronization issue between javascript functions.

Today I upgraded to last version (3.2.0) but it still happens.

### Technical details:

- Ghost Version: 3.2.0
- Node Version: v8.16.0
- Browser/OS: Ubuntu 16.04 / last versions of chrome and firefox
- Database: mysql 5.7

### ghost doctor

Ghost doctor returns green checks for everything:

```auto
✔ Checking system Node.js version
✔ Checking logged in user
✔ Ensuring user is not logged in as ghost user
✔ Checking if logged in user is directory owner
✔ Checking current folder permissions
✔ Checking operating system compatibility
✔ Checking for a MySQL installation
+ sudo systemctl is-active ghost_blog-csimadroom-com
Instance is currently running
ℹ Validating config [skipped]
✔ Checking folder permissions
✔ Checking file permissions
✔ Checking content folder ownership
✔ Checking memory availability

```

Any idea what can be causing the issue?

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 7, 2020, 12:34pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/2 "2020-01-07T12:34:02Z")

</div>

@koldLight I’m able to access your admin page OK, no JS errors. It sounds like somewhere you’ve got a cached version of the admin app’s JS files that is corrupted.

Are you running any caches or a CDN in front of your site?

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 7, 2020, 12:39pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/3 "2020-01-07T12:39:46Z")

</div>

Hmm, accessing with Chrome rather than Safari did throw an error on first load. For some reason the file was not served correctly…

```auto
GET https://blog.csimadroom.com/ghost/assets/vendor.min-ce5fecf6439755119f2525c342c489f1.js net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
Uncaught ReferenceError: define is not defined

```

The file is being served completely blank even though it’s a 200 response, that explains the `define is not defined` error because the `define` function definition is not present in a blank file.

What hosting setup are you using?

---

<div class="post-metadata">

**Author:** ![koldLight](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/koldlight/32/5733_2.png) [@koldLight](https://forum.ghost.org/u/koldLight)\
**Post date:** [January 7, 2020, 1:34pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/4 "2020-01-07T13:34:52Z")

</div>

Thanks for the quick response!

I’m hosting ghost on my own virtual machine, a ubuntu 16.04, shared with other resources. I’m using nginx with ssl (via letsencrypt).

My nginx configuration looks like this:

```auto
# HTTP - redirect all requests to HTTPS:
server {
  listen 80;
  server_name blog.csimadroom.com;

  error_log /var/log/nginx/blog_error.log;
  access_log /var/log/nginx/blog_access.log;

  return 301 https://$host$request_uri;
}

# HTTPS - proxy requests on to local Node.js app:
server {
  listen 443;
  server_name blog.csimadroom.com;
  root /apps/blog/blog/system/nginx-root;

  ssl on;
  ssl_certificate /etc/letsencrypt/live/csimadroom.com/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/csimadroom.com/privkey.pem;
  ssl_trusted_certificate /etc/letsencrypt/live/csimadroom.com/chain.pem;

  error_log /var/log/nginx/blog_error.log;
  access_log /var/log/nginx/blog_access.log;

  location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    proxy_pass http://127.0.0.1:2368;
  }

  location ~ /.well-known {
    allow all;
  }

  client_max_body_size 50m;

}

```

My ghost config.json is:

```auto
{
  "url": "https://blog.csimadroom.com",
  "server": {
    "port": 2369,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "mysql",
    "connection": {
      "host": "localhost",
      "user": "XXXXXXX",
      "password": "XXXXXXXXXX",
      "database": "XXXXX"
    }
  },
  "mail": {
    "transport": "Direct",
    "options": {
      "service": "Mailgun",
      "auth": {
        "user": "XXXXXXXX",
        "pass": "XXXXXXXX"
      }
    },
    "from": "MY_EMAIL"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/apps/blog/blog/content"
  },
  "bootstrap-socket": {
    "port": 8000,
    "host": "localhost"
  }
}

```

---

<div class="post-metadata">

**Author:** ![koldLight](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/koldlight/32/5733_2.png) [@koldLight](https://forum.ghost.org/u/koldLight)\
**Post date:** [January 7, 2020, 3:53pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/5 "2020-01-07T15:53:18Z")

</div>

I don’t know why my ghost config json was on port 2369 and nginx was reverse proxying 2368, and I put both on 2368. But the issue is still there.

Yes, it looks like the vendor.min.js is not being served OK. The rest of the css / js resources are OK:

 ![ghost_issue](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/1/1925b4c48e3d3dd444f482f4640d1e83bf5121cb.png)

I’m not using any external CDN, just my server.

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [January 8, 2020, 9:59am UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/6 "2020-01-08T09:59:55Z")

</div>

@koldLight doing a google search for “nginx net::ERR\_INCOMPLETE\_CHUNKED\_ENCODING” it sounds like it could be a permissions problem on your server.

When nginx proxies a file over a particular size it can write it to disk as a temporary file, if the permissions on it’s directory are incorrect then it can result in the error you’re seeing. There’s a related stack overflow answer here [ruby on rails - net::ERR\_INCOMPLETE\_CHUNKED\_ENCODING nginx - Stack Overflow](https://stackoverflow.com/a/32852154/1163866)

If it doesn’t seem to be that, maybe look into the resource usage on your server to make sure you’re not hitting any memory or disk space limits.

---

<div class="post-metadata">

**Author:** ![koldLight](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/koldlight/32/5733_2.png) [@koldLight](https://forum.ghost.org/u/koldLight)\
**Post date:** [January 11, 2020, 3:20pm UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/7 "2020-01-11T15:20:42Z")

</div>

Thanks! You hit the nail on the head, I just had to fix the ownership of `/var/lib/nginx`.

I thought it was a migration related issue because it started happening after migrating from v1 to v3. But what happened was that, after the migration, the vendor.min.js grew and nginx started using `/var/lib/nginx` as a working directory for temporary large files.

Thanks for the help 🙂

---

<div class="post-metadata">

**Author:** ![Sholikul\_Huda](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/sholikul_huda/32/25435_2.png) [@Sholikul\_Huda](https://forum.ghost.org/u/Sholikul_Huda)\
**Post date:** [July 18, 2023, 12:59am UTC](https://forum.ghost.org/t/referenceerror-define-is-not-defined-on-admin-page/11214/8 "2023-07-18T00:59:21Z")

</div>

@koidLight thank you, you saved my day.

I change the ownership of /var/lib/nginx and now its working.
