Load image componant not working

Hi all,

I am running Node.js and the “load image” component is not working in my workflows. I keep getting the below error. I think I am missing a module. Can someone help me out on this?

“status”: “500”,
“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. (/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)”

yeah just make sure and upload. Depending on what your site definition is configured Production/development whichever, if its set to production you might have to manually push the components over. so under files click the root of the site and then the upload button. And then watch which files get uploaded from the lower part of the screen for that stuff. Its friday and my brain is frazzled.

Im in development mode.

Do I just need to install the component?

no it just needs to be uploaded to your server

Ahhh I see. So I am in dev mode just using my local host. The error I posted was from the preview in my browser.

So shouldn’t the file already be on my local host since it comes with Wappler?

thats what you need to check. I’m not a node.js expert, so not sure. Might need to get some @teodor love… Pretty late on a Friday. Might be a Monday fix…

I’m signing off for the weekend. Have a good one!

1 Like

Thank you for your help

1 Like

The sharp module should auto be added to your package.json in NodeJS when using image actions but lets just check it was added:

  1. On the very left of Wappler choose the tab that’s shows your pages (site manager)
  2. After you are in this tab at the top you will see Pages Assets Files And Search, select files
  3. Open the first folder and you should see package.json

After you open package.json just make sure it contains:
"sharp": "^0.29.3"

If it does try just installing node packages located in Wappler’s bottom bar near the terminal.

1 Like

Thank you so much. I’ll give it a try and let you know how it goes

So this did not work. I am showing “sharp”: “^0.29.3”, in my package.json file but it is still not working.