【发布时间】:2020-05-24 14:37:39
【问题描述】:
我在 Strapi 中遇到了这个错误,不得不跳过几圈来解决它。如果您收到此错误,则说明您的 mongoose 配置没有问题。我正在使用节点 10.15.3 和 npm 6.4.1 和 Strapi 3.0.0-beta.18.3 https://github.com/strapi/strapi/releases/tag/v3.0.0-beta.18.3
【问题讨论】:
我在 Strapi 中遇到了这个错误,不得不跳过几圈来解决它。如果您收到此错误,则说明您的 mongoose 配置没有问题。我正在使用节点 10.15.3 和 npm 6.4.1 和 Strapi 3.0.0-beta.18.3 https://github.com/strapi/strapi/releases/tag/v3.0.0-beta.18.3
【问题讨论】:
我遇到的问题与 Strapi 代码库有关。
第一个问题是 Strapi 读取我在模型文件中的两个枚举。
在我的/api/artists/models/Artists.settings.json 文件中,我有以下内容
"genres_new": {
"enum": [
"hip hop",
"r&b",
"pop",
"dance"
],
"type": "enumeration"
},"
我必须从r & b 中删除& 并使其成为r and b
"genres_new": {
"enum": [
"hip hop",
"r and b",
"pop",
"dance"
],
"type": "enumeration"
},"
我还有一个枚举,其中包含 1..10 中的一系列整数,我必须将其完全删除。
进行这些更改后,我通过执行以下操作升级到 v3.0.0-beta.18.3:
更新您的 package.json 依赖项
"strapi": "3.0.0-beta.18.3",
"strapi-admin": "3.0.0-beta.18.3",
"strapi-connector-mongoose": "3.0.0-beta.18.3",
"strapi-plugin-content-manager": "3.0.0-beta.18.3",
"strapi-plugin-content-type-builder": "3.0.0-beta.18.3",
"strapi-plugin-email": "3.0.0-beta.18.3",
"strapi-plugin-graphql": "3.0.0-beta.18.3",
"strapi-plugin-upload": "3.0.0-beta.18.3",
"strapi-plugin-users-permissions": "^3.0.0-next.41",
"strapi-utils": "3.0.0-beta.18.3"
}
更新模块,清除缓存并构建目录
npm install strapi-connector-strapi-hook-mongoose
npm install -g install-peerdeps
npm install
npm audit fix
rm -rf .cache
rm -rf build
npm run dev
然后我得到以下错误
error TypeError: fn is not a function
at execBootstrap (.../src/node_modules/strapi/lib/Strapi.js:381:15)
at Strapi.runBootstrapFunctions (.../src/node_modules/strapi/lib/Strapi.js:399:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
我按照Compile error when starting strapi in development mode #4015 此处的说明修复了它
然后我可以启动我的 Strapi 服务器
npm run start
【讨论】:
请参阅迁移指南,因为它解释了您需要做什么:https://strapi.io/documentation/3.0.0-beta.x/migration-guide/migration-guide-beta.17-to-beta.18.html#upgrading-your-dependencies
"strapi-connector-mongoose": "3.0.0-beta.18.3",
【讨论】: