Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolving Module Path Issues in Strapi: Adapting Plugin Code for Strapi Version 4.14.4 #19

Open
Simoneplataniafutureait opened this issue Oct 16, 2023 · 5 comments

Comments

@Simoneplataniafutureait

In the current version of Strapi (4.14.4), there is no lib folder inside the @strapi/strapi module, and I had to manually change the path (services files of the server folder) in the plugin module to "dist."

NEW:
const {
getPaginationInfo,
convertPagedToStartLimit,
shouldCount,
transformPaginationResponse,
} = require('@strapi/strapi/dist/core-api/service/pagination');

const { getFetchParams } = require('@strapi/strapi/dist/core-api/service');

OLD:
const {
getPaginationInfo,
convertPagedToStartLimit,
shouldCount,
transformPaginationResponse,
} = require('@strapi/strapi/lib/core-api/service/pagination');

const { getFetchParams } = require('@strapi/strapi/lib/core-api/service');

In my configuration, I'm using Yarn, and the server stopped with this error displayed on the console:

$ strapi develop
Error: Could not load js config file /var/www/vhosts/zen-chaplygin.62-138-11-62.plesk.page/httpdocs/node_modules/strapi-plugin-fcm/strapi-server.js: Cannot find module '@strapi/strapi/lib/core-api/service/pagination'

In the end, I managed to fix it temporarily with the solution above, but I don't know much about Strapi's structure, and I'm not sure if this could be helpful. However, I wanted to issue a warning about this.

@vasuchawla
Copy link

facing the same issue.

@ericdmoraes
Copy link

facing the same error. tried to fix with your solution but didn't work. any other way?

@jamesnyika
Copy link

Hi ..

Yeah this is now a blocker
Same error even after making the changes from lib to dist

Error: Could not load js config file /mnt/appdata/app/stata/node_modules/strapi-plugin-fcm/strapi-server.js: Package subpath './dist/core-api/service/pagination' is not defined by ││ "exports" in /mnt/appdata/app/stata/node_modules/@strapi/strapi/package.json ││ at loadJsFile (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/core/app-configuration/load-config-file.js:18:13) ││ at Module.loadFile (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/core/app-configuration/load-config-file.js:37:14) ││ at Object.loadPlugins (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/core/loaders/plugins/index.js:90:41) ││ at async Strapi.loadPlugins (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/Strapi.js:311:5) ││ at async Promise.all (index 3) ││ at async Strapi.register (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/Strapi.js:341:5) ││ at async Strapi.load (/mnt/appdata/app/stata/node_modules/@strapi/strapi/dist/Strapi.js:425:5) ││ at async Object.develop (/mnt/appdata/app/stata/node_modules/@strapi/admin/dist/_chunks/index-sNH2VWbC.js:837:28) ││ at async develop (/mnt/appdata/app/stata/node_modules/@strapi/admin/dist/_chunks/develop-YNTGWKMC.js:61:5) ││ at async Command.parseAsync (/mnt/appdata/app/stata/node_modules/commander/lib/command.js:923:5)

@Prashant4900
Copy link

@jamesnyika I am also getting the same error did you get any solution?

@marcogermani87
Copy link

marcogermani87 commented May 26, 2024

Hi @jamesnyika, fixed on my fork https://github.com/marcogermani87/strapi-plugin-fcm (working with strapi v4.24.3):

npm i https://github.com/marcogermani87/strapi-plugin-fcm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants