System Information
- Strapi Version: 4.1.9
- Operating System: Windows 10
- Database: Postgres
- Node Version: 12.22.4
- NPM Version: 6.14.14
- Yarn Version: 1.22.18
Hi,
I created a Strapi project using the latest version 4.1.9 (executing the command npx create-strapi-app@latest my-app
). I dockerized it along with an image of Postgres. Everything works fine excepted when I introduce some plugins from marketplace.
I really need the following plugins:
plugin-documentation:
I installed it executing the command yarn add @strapi/plugin-documentation
, the dependency “@strapi/plugin-documentation”: “^4.1.9” has been correctly added to package.json, I regenerated node_modules that now includes the plugin. Nothing changed neither in the admin panel nor in the src folder.
What should I expect and what am I missing?
strapi-plugin-transformer:
I discovered today the existence of this plugin since I was desperately wanted to flatten the response returned by the Strapi API in version 4 (with data and attributes fields). I followed this guide for the installation and configuration. Also in this case package.json and node_modules have been correctly updated.
I created the file ./config/plugins.js
like this:
module.exports = ({ env }) => ({
// ..
'transformer': {
enabled: true,
config: {
prefix: '/api/',
responseTransforms: {
removeAttributesKey: true,
removeDataKey: true,
}
}
},
// ..
});
The absence of a definition for the attribute “resolve” causes the following error:
strapi_1 | [2022-05-02 17:16:19.878] debug: ?? Server wasn’t able to start properly.
strapi_1 | [2022-05-02 17:16:19.879] error: The “path” argument must be of type string. Received undefined
strapi_1 | TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined
strapi_1 | at new NodeError (internal/errors.js:322:7)
strapi_1 | at validateString (internal/validators.js:124:11)
strapi_1 | at join (path.js:1148:7)
strapi_1 | at Object.loadPlugins (/opt/node_modules/@strapi/strapi/lib/core/loaders/plugins/index.js:89:34)
strapi_1 | at async Strapi.loadPlugins (/opt/node_modules/@strapi/strapi/lib/Strapi.js:284:5)
strapi_1 | at async Promise.all (index 1)
strapi_1 | at async Strapi.register (/opt/node_modules/@strapi/strapi/lib/Strapi.js:316:5)
strapi_1 | at async Strapi.load (/opt/node_modules/@strapi/strapi/lib/Strapi.js:414:5)
strapi_1 | at async Strapi.start (/opt/node_modules/@strapi/strapi/lib/Strapi.js:163:9)
strapi_1 | info Visit yarn run | Yarn for documentation about this command.
strapi_1 | error Command failed with exit code 1.
Setting the “resolve” attribute with a fake path makes the application running but obviously the plugin has no effect.
Is the plugin supported in the latest version of Strapi? Why do I obtain this error even if it’s installed as a node module and it’s not a custom one? Is there an alternative to strapi-plugin-transformer in case I want to receive a response closer to the one returned by Strapi v3 without the fields “data” and “attributes”?
I truly hope someone could help me to solve my issue, I can provide you with further details in case you need them.