我的 Strapi 管理面板现在在本地主机上无限期地显示加载状态

My Strapi admin panel is now showing loading status indefinitely on localhost

几天前情况并非如此,昨天在进行一些更改后随机发生,因为我已将大量新字段属性添加到特定集合类型...

从那以后,我的 Strapi CMS NodeJS 后端随机不再加载到我的本地主机上,它显示无限加载状态...

当我第一次访问我的 localhost:1337 时,这是我得到的,它一切正常并且已正确加载:

但是,当我单击“打开管理”按钮访问 Strapi 管理面板时,我被定向到“http:///localhost/admin”并获得以下信息:

当我点击网络选项卡中的管理错误时,它显示如下:

通常情况下,“打开管理”选项卡会将我重定向到 http://localhost:1337/admin,但显然这次没有。

现在我尝试访问 http://localhost:1337/admin 并且 这是我收到看似无限加载错误的地方...

第一个(失败的)提取错误(在预检错误之上,因为这是导致预检错误的原因),显示:

我的server.js文件如下:

module.exports = ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  cron: { enabled: true },
  url: env('URL', 'http://localhost'),


  admin: {
    auth: {
      secret: env('ADMIN_JWT_SECRET', '9bf8cc74ab83590b280df0851beaec60'),
    },
  },
});

我的package.json如下:

{
  "name": "Strapi-Backend",
  "private": true,
  "version": "0.1.0",
  "description": "The Strapi backend of a JAMstack e-commerce platform built for a Udemy course.",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {},
  "dependencies": {
    "strapi": "3.6.8",
    "strapi-admin": "3.6.8",
    "strapi-connector-mongoose": "3.6.8",
    "strapi-plugin-content-manager": "3.6.8",
    "strapi-plugin-content-type-builder": "3.6.8",
    "strapi-plugin-email": "3.6.8",
    "strapi-plugin-graphql": "^3.6.8",
    "strapi-plugin-upload": "3.6.8",
    "strapi-plugin-users-permissions": "3.6.8",
    "strapi-provider-email-sendgrid": "^3.6.8",
    "strapi-provider-upload-aws-s3": "^3.6.8",
    "strapi-utils": "3.6.8",
    "stripe": "^8.135.0"
  },
  "author": {
    "name": "Zachary Reece"
  },
  "strapi": {
    "uuid": "5e0b8d89-62ac-4e4e-995b-08644071605b"
  },
  "engines": {
    "node": ">=10.0.0",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

更改server.js并尝试:

module.exports = ({ env }) => {
  const port = env('PORT', '1337');
  const host = env('HOST', '0.0.0.0');
  const url = env('URL', `http://localhost${port !== '80' ? ':'+port : ''}`);
  const adminAuthSecret = env('ADMIN_JWT_SECRET', '9bf8cc74ab83590b280df0851beaec60');
  
  return {
    host, port, url,
    cron: { enabled: true },
    cors: { enabled: true, origin: ['*'] },
    admin: {
      auth: { secret: adminAuthSecret },
    }
  }
};