strapi-plugin-images
strapi-plugin-images copied to clipboard
Failed to install: TypeError: Cannot read property 'routes' of undefined
Hi,
I'm testing this plugin because i need to crop all images to a standard size, but after install it i cannot run the server:
yarn run v1.19.1
$ strapi develop
[2019-12-03T08:35:48.699Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-03T08:35:48.699Z] error TypeError: cb is not a function
at Object.initialize (/home/joselito92/Proyectos/Work/ibrazil/backend/plugins/images/middlewares/images/index.js:41:5)
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi/lib/middlewares/index.js:43:28
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
✘ joselito92@joselito-asus-rog ~/Proyectos/Work/ibrazil/backend yarn develop
yarn run v1.19.1
$ strapi develop
[2019-12-03T08:36:23.425Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-03T08:36:23.427Z] error TypeError: Cannot read property 'routes' of undefined
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi-plugin-users-permissions/middlewares/users-permissions/index.js:35:35
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/lodash/lodash.js:4905:15
at baseForOwn (/home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/lodash/lodash.js:2990:24)
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/lodash/lodash.js:4874:18
at Function.forEach (/home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/lodash/lodash.js:9342:14)
at Object.initialize (/home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi-plugin-users-permissions/middlewares/users-permissions/index.js:34:11)
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi/lib/middlewares/index.js:43:28
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have this folder structure:
If i did all correct, what is the problem then?
If i just install it by yarn add strapi-plugin-images --no-save
, I get this bug:
yarn develop
yarn run v1.19.1
$ strapi develop
[2019-12-03T08:54:26.937Z] debug ⛔️ Server wasn't able to start properly.
[2019-12-03T08:54:26.938Z] error TypeError: cb is not a function
at Object.initialize (/home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi-plugin-images/middlewares/images/index.js:41:5)
at /home/joselito92/Proyectos/Work/ibrazil/backend/node_modules/strapi/lib/middlewares/index.js:43:28
at processTicksAndRejections (internal/process/task_queues.js:93:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This issue is related to: https://github.com/Froelund/strapi-plugin-images/issues/9
So, what's the problem? Thanks.
edit file node_modules@strapi\plugin-i18n\server\services\core-api.js
185 in function addCreateLocalizationAction(.....
if( strapi.api[apiName].routes[modelName]){
strapi.api[apiName].routes[modelName].routes.push(localizationRoute);
strapi.container.get('controllers').extend(`api::${apiName}.${modelName}`, (controller) => {
return Object.assign(controller, {
createLocalization: createLocalizationHandler(contentType),
});
});
}