我有一个局部的strapi应用(我在git reto中有一个(,我想从使用sqlite3迁移到使用mongodb
我做了以下操作:
-
创建了一个从一开始就成功使用MongoDB的第二个临时,strapi应用
-
从临时,working-mongodb,strapi应用程序中复制了数据库。(确保正在开发并运行开发版本(
来自我现有的应用程序(我想从中使用mongodb(,i
-
卸载:
-
strapi-hook-bookshelf
-
strapi-hook-knex
-
knex
-
sqlite3
-
-
安装了strapi-hook-mongoose
注意:
- 如果我继续使用sqlite3,现有的应用程序(我想从中使用mongoDB(成功运行。
- 我使用Quickstart选项创建了现有应用
但是,我仍然会遇到此错误...终端输出,摘要下方
终端输出摘要:
(node:37499) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
(node:37499) UnhandledPromiseRejectionWarning: TypeError: orm.load(...).buildQuery is not a function
at buildQuery (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-utils/lib/buildQuery.js:122:21)
at Object.count (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/config/queries/mongoose.js:18:12)
at Object.initialize (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/services/UsersPermissions.js:502:8)
at module.exports (/Users/monico_a_moreno/source/.../folder-strapi-poc/node_modules/strapi-plugin-users-permissions/config/functions/bootstrap.js:156:65)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:37499) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:37499) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[2019-07-03T18:27:15.985Z] warn The bootstrap function is taking unusually long to execute (3500 miliseconds).
[2019-07-03T18:27:15.986Z] warn Make sure you call it?
What am I doing wrong? 🤔
这很酷!我可以回答自己的问题!😜
认真地说,我正在回答自己的问题,以使其他人的好处可能遇到同一问题。
底线:我安装了错误的strapi-hook-mongoose
版本。
详细信息:当我安装strapi-hook-mongoose
时,我没有指定版本,因此,NPM已安装^3.0.0-alpha.13
,并且由于我现有的Strapi项目在(当时(最新的事实中v3.0.0-beta.7
,它无法运行(给出了上述描述中描述的错误(。
解决方案:卸载软件包并重新安装,显式指定版本👇
npm i strapi-hook-mongoose@3.0.0-beta.7