Since a long time I tested an image upload function which gives an error now, I updated Wappler multiple times since I tested it so don’t know when it broke.

I get the following error message:

message: "Cannot find module 'sharp'\nRequire stack:\n- /opt/node_app/lib/modules/image.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js"
stack: "Error: Cannot find module 'sharp'\nRequire stack:\n- /opt/node_app/lib/modules/image.js\n- /opt/node_app/lib/core/app.js\n- /opt/node_app/lib/core/middleware.js\n- /opt/node_app/lib/setup/routes.js\n- /opt/node_app/lib/server.js\n- /opt/node_app/index.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)\n    at Function.Module._load (internal/modules/cjs/loader.js:667:27)\n    at Module.require (internal/modules/cjs/loader.js:887:19)\n    at require (internal/modules/cjs/helpers.js:74:18)\n    at Object.<anonymous> (/opt/node_app/lib/modules/image.js:2:15)\n    at Module._compile (internal/modules/cjs/loader.js:999:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)\n    at Module.load (internal/modules/cjs/loader.js:863:32)\n    at Function.Module._load (internal/modules/cjs/loader.js:708:14)\n    at Module.require (internal/modules/cjs/loader.js:887:19)"
status: "500"

As stated in the release notes of the recent Wappler updates, we moved to optional installation of NodeJS modules.

So to indicate that you have used the image processor sharp module, you need just to re-save an action that uses the image processor.

Hi @George. I re-saved all actions again, still giving the same error…

If this is in a library, make sure you are on the latest version of Wappler. Sharp module not installed from Library save

Hi Ken, I am on the latest version of Wappler. When I first re-saved the action I saw that it started to install node packages etc so don’t know what went wrong that it still doesn’t work…

Try hitting the install node modules icon.

I did, didn’t work. Thank you for suggestions though

Well is the Sharp module listed in your package.json?

Also did you deploy to the target where you are getting the error?

Just clicked on deploy, since I did that I’m having this issue:

With every restart of docker it all works for 10 seconds and then I get ERR_EMPTY_RESPONSE error. It’s a bit concerning now as now I can’t continue to work at all. How do I resolve this?

It was happening when loading a page that contained a specific server action which I edited just before. Don’t exactly know what was happening but after deleting that action it all works now. The image module works now too.

Thanks, good evening

I was wondering ,since I am experience some problems also, do you have a crop step in your api action? And if so, does it work when you use an image taken by your phone?

I am trying to figure out if there is a bug in the Sharp module or somewhere else…

Hi, no I don’t have a crop step. When I had the issue it got somehow resolved when clicking on install node packages + deploy button etc so maybe try that? Otherwise not sure

Thanks for the tip, i’ll give it a shot. @htatd

I’m getting this error when trying to re install the sharp module:

Installing Node Packages ...
npm WARN registry Using stale data from because the host is inaccessible -- are you offline?
npm WARN registry Using stale data from due to a request error during revalidation.
npm ERR! code ETARGET
npm ERR! notarget No matching version found for sharp@^0.29.3.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/carlitos/.npm/_logs/2022-01-13T01_36_15_700Z-debug.log
Error Installing Node Packages!

In the log file I founded this:

37 verbose stack sharp: No matching version found for sharp@^0.29.3.
37 verbose stack     at module.exports (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:207:23)
37 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/registry.js:117:26
37 verbose stack     at async Arborist.[nodeFromEdge] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:890:19)
37 verbose stack     at async Arborist.[buildDepStep] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:838:11)
37 verbose stack     at async Arborist.buildIdealTree (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:209:7)
37 verbose stack     at async Arborist.prune (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/pruner.js:9:5)
37 verbose stack     at async Prune.prune (/usr/local/lib/node_modules/npm/lib/prune.js:27:5)

as the error says … Are you offline? Your internet connection was not available during the install.
So just try again.