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

Strapi-plugin-image-optimizer error on updating to strapi v4.14.4 #29

Open
yarikwest opened this issue Oct 11, 2023 · 9 comments
Open

Comments

@yarikwest
Copy link
Contributor

yarikwest commented Oct 11, 2023

Error: Could not load js config file /home/jaro/work/landing/server/node_modules/strapi-plugin-image-optimizer/strapi-server.js: Cannot find module '@strapi/utils/dist/file'

I think it because of strapi/strapi#18308

@yarikwest
Copy link
Contributor Author

for quick fix add "@strapi/utils": "4.14.3" to package.json

@soranoo
Copy link

soranoo commented Oct 19, 2023

I added

"resolutions": {
    "@strapi/utils": "4.14.4"
  }

to my Strapi package.json but the error Error: Could not load js config file C:\Users\example\strapi-project\node_modules\strapi-plugin-image-optimizer\strapi-server.js: Cannot find module '@strapi/utils/dist/file' still pops up.

@yarikwest
Copy link
Contributor Author

I added

"resolutions": {
    "@strapi/utils": "4.14.4"
  }

to my Strapi package.json but the error Error: Could not load js config file C:\Users\example\strapi-project\node_modules\strapi-plugin-image-optimizer\strapi-server.js: Cannot find module '@strapi/utils/dist/file' still pops up.

Because this issue appears in strapi v.4.14.4. Just change @strapi/utils version on lower

@soranoo
Copy link

soranoo commented Oct 19, 2023

I tested from 4.14.3 all the way down to 4.12.0 but still the same result.

Here's my dependencies

"dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.9",
    "@escape.tech/graphql-armor": "^2.3.1",
    "@strapi/plugin-graphql": "^4.14.4",
    "@strapi/plugin-i18n": "4.14.4",
    "@strapi/plugin-users-permissions": "4.14.4",
    "@strapi/strapi": "4.14.4",
    "build": "^0.1.4",
    "mysql": "2.18.1",
    "strapi-plugin-image-optimizer": "^2.1.1",
    "strapi-plugin-sitemap": "^3.0.3",
    "strapi-provider-ftp-upload": "^1.0.0",
    "strapi-ulid": "^0.1.3",
    "zod": "^3.22.4"
  },
"resolutions": {
    "@strapi/utils": "4.14.3" // 4.14.2, 4.14.0, 4.13.7, 4.13.6, 4.13.5, 4.13.4, 4.13.3, 4.13.2, 4.13.1, 4.12.7, 4.12.6, 4.12.5, 4.12.4, 4.12.1, 4.12.0
  },

@yarikwest
Copy link
Contributor Author

I tested from 4.14.3 all the way down to 4.12.0 but still the same result.

Here's my dependencies

"dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.9",
    "@escape.tech/graphql-armor": "^2.3.1",
    "@strapi/plugin-graphql": "^4.14.4",
    "@strapi/plugin-i18n": "4.14.4",
    "@strapi/plugin-users-permissions": "4.14.4",
    "@strapi/strapi": "4.14.4",
    "build": "^0.1.4",
    "mysql": "2.18.1",
    "strapi-plugin-image-optimizer": "^2.1.1",
    "strapi-plugin-sitemap": "^3.0.3",
    "strapi-provider-ftp-upload": "^1.0.0",
    "strapi-ulid": "^0.1.3",
    "zod": "^3.22.4"
  },
"resolutions": {
    "@strapi/utils": "4.14.3" // 4.14.2, 4.14.0, 4.13.7, 4.13.6, 4.13.5, 4.13.4, 4.13.3, 4.13.2, 4.13.1, 4.12.7, 4.12.6, 4.12.5, 4.12.4, 4.12.1, 4.12.0
  },

Add it into dependencies section, not resolutions. And don’t forget rerun build command

@soranoo
Copy link

soranoo commented Oct 19, 2023

It WORKS !!!!!! Many thanks.

Strapi can up to 4.14.5 (the latest)
with "@strapi/utils: "4.14.3" (4.14.4 & 4.14.5 failed is test)

@ohbob
Copy link

ohbob commented Oct 26, 2023

How did you guys manage to fix this adding utils? i get errors even on installing the package. Any plans on releasing a fix?

@soranoo
Copy link

soranoo commented Oct 28, 2023

Add "@strapi/utils": "4.14.3" to ur package.json

  "dependencies": {
    "@strapi/plugin-i18n": "4.15.0",
    "@strapi/plugin-users-permissions": "4.15.0",
    "@strapi/strapi": "4.15.0",
    "build": "^0.1.4",
    "mysql": "2.18.1",
    "strapi-plugin-image-optimizer": "^2.1.1",
    "strapi-provider-ftp-upload": "^1.0.3",
    "strapi-ulid": "^0.1.3",
    "zod": "^3.22.4",
    "@strapi/utils": "4.14.3" // <- this line
  },

And then run npm i && npm run build

@ZahiriNatZuke
Copy link

ZahiriNatZuke commented Dec 5, 2023

I have this error:
" Error: Could not load js config file C:\ZnZ\Projects\imd-cms\node_modules\strapi-plugin-image-optimizer\strapi-server.js: Package subpath './server/services/image-manipulation' is not defined by "exports" in │
│ C:\ZnZ\Projects\imd-cms\node_modules@strapi\plugin-upload\package.json"

"dependencies": {
    "@ckeditor/strapi-plugin-ckeditor": "^0.0.10",
    "@strapi/plugin-cloud": "4.15.5",
    "@strapi/plugin-content-source-map": "^0.2.0",
    "@strapi/plugin-documentation": "4.15.5",
    "@strapi/plugin-i18n": "^4.15.5",
    "@strapi/plugin-sentry": "^4.15.5",
    "@strapi/plugin-seo": "^1.9.8",
    "@strapi/plugin-users-permissions": "4.15.5",
    "@strapi/provider-upload-local": "^4.15.5",
    "@strapi/strapi": "4.15.5",
    "@strapi/typescript-utils": "^4.15.5",
    "@strapi/utils": "4.14.3",
    "pg": "8.8.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "5.3.4",
    "strapi-advanced-uuid": "^1.1.4",
    "strapi-plugin-image-optimizer": "^2.1.1",
    "strapi-plugin-schemas-to-ts": "^1.1.21",
    "strapi-plugin-sitemap": "^3.0.6",
    "styled-components": "5.3.3"
  },

i can run without problem npm run build command, but when i try to run npm run develop i got that error.

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

4 participants