node.js - Strapi:警告请求 API 时发生错误

标签 node.js ubuntu strapi

我一直在努力尝试在我的 Ubuntu 服务器上安装 Strapi 几个小时。

Ubuntu: 20.04
nodejs: v14.19.0
npm: 6.14.16
strapi: 4

npx create-strapi-app@latest my-project --quickinstall
所有的安装过程都是无缝的,但是当我去 http://mydomain:1337/admin 以创建第一个用户时,我收到了这个警告:

an error occurred while requesting the API.


我知道这个问题已经遇到过好几次了,但到目前为止,没有一个建议的解决方案对我有帮助。
我也在 Chrome 控制台中发现了这个错误,但我不确定它是否与我的问题有关:

main.815f1087.js:2 Refused to connect to 'http://localhost:1337/admin/project-type' because it violates the following Content Security Policy directive: "connect-src 'self' https:".


任何想法 ?

最佳答案

您需要构建应用程序。 Read this github issue
运行:npm run buildyarn buildstrapi build取决于您使用的是什么

关于node.js - Strapi:警告请求 API 时发生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70957481/

相关文章:

node.js - 在 VMWare 下,Node.js Azure Web 角色无法运行

linux - 无法联系 Kerberos 中的任何 KDC?

php - composer update failed 您的要求无法解析为一组可安装的软件包

linux - 如何从不同的文本文件复制字符串以在单独的列中并排显示到 Bash 中的第三个文件中

javascript - 如何防止浏览器打开启动 Strapi

android - 如何将 Thrift 模块与 React Native 集成?

node.js - Express - POST 请求挂起

reactjs - 如何从 Strapi API 引用 Next JS 中的图像组件?

javascript - JS 什么时候将 {} 解释为空 block 而不是空对象?

reactjs - 想要将文件上传到 Strapi 时请求实体太大