jamelo#2709
jamelo#27096mo ago

Hello, how do I use npm packages in buildship, how do I install them? For example, I need to use Pu

Hello, how do I use npm packages in buildship, how do I install them? For example, I need to use Puppertier
Solution:
Hi @jamelo#2709 To import any node library to BuildShip, Make sure to always import any packages using Named import declaration. Example: import module from "module-name"; & import Crypto from 'crypto'; The best way is to generate using AI https://www.youtube.com/watch?v=AawYfYW8xu0....
BuildShip
YouTube
Generating Custom Nodes with AI - BuildShip AI Workflow Builder
Get started with BuildShip for FREE 👉 https://buildship.com A Low-code Visual Backend Builder with AI 💬 Chat and build together with a community of no-code/low-code developers: https://buildship.com/discord 🐦 Tweets: https://twitter.com/buildshipapp #nocode #backend #apibuilder #lowcode #cronjob #scheduledtask #backgroundjob #googlecloud #ope...
Jump to solution
19 Replies
AI Support
AI Support6mo ago
To use npm packages like Puppeteer in BuildShip, you need to follow these steps: 1. Access the Workflow Editor: Open your workflow in the BuildShip editor. 2. Add a Code Node: Insert a Code Node where you want to use the npm package. 3. Install the npm Package: In the Code Node, you can specify the npm packages you need. For example, to install Puppeteer, you can include it in the dependencies section. Here is a general outline of the steps: 1. Add a Code Node: In your workflow, add a Code Node. 2. Specify Dependencies: In the Code Node, you can specify the dependencies you need. For example, to use Puppeteer, you can define it like this:
{
"dependencies": {
"puppeteer": "^10.0.0"
}
}
{
"dependencies": {
"puppeteer": "^10.0.0"
}
}
3. Use the Package: After specifying the dependencies, you can write your code using the npm package within the same Code Node. For detailed documentation, please refer to the BuildShip Documentation. If you have any further questions, please submit them via the in-app support button.
jamelo#2709
jamelo#2709OP6mo ago
Sorry, but I couldn't find where to type the dependencies
AI Support
AI Support6mo ago
To add dependencies in BuildShip, you need to use the "Dependencies" section within your workflow setup. For specific instructions on how to manage dependencies, please refer to the BuildShip documentation. You can access the relevant documentation page here. If you cannot find the information you need, please submit your query via the in-app support button.
jamelo#2709
jamelo#2709OP6mo ago
No description
AI Support
AI Support6mo ago
Sure, I'd be happy to assist! Could you please provide more details about your question related to BuildShip?
Solution
Gaurav Chadha
Gaurav Chadha6mo ago
Hi @jamelo#2709 To import any node library to BuildShip, Make sure to always import any packages using Named import declaration. Example: import module from "module-name"; & import Crypto from 'crypto'; The best way is to generate using AI https://www.youtube.com/watch?v=AawYfYW8xu0.
BuildShip
YouTube
Generating Custom Nodes with AI - BuildShip AI Workflow Builder
Get started with BuildShip for FREE 👉 https://buildship.com A Low-code Visual Backend Builder with AI 💬 Chat and build together with a community of no-code/low-code developers: https://buildship.com/discord 🐦 Tweets: https://twitter.com/buildshipapp #nocode #backend #apibuilder #lowcode #cronjob #scheduledtask #backgroundjob #googlecloud #ope...
robot007
robot0074mo ago
@Gaurav Chadha @AI Support I have a similiar package installation question. I need "sharp" to convert a PNG file to a JPG file, and got the following error: I want to change image file format from PNG to JPG, and I got the following error message. Please help. Thanks a lot. ----------------------------------------- Could not load the "sharp" module using the linux-x64 runtime Possible solutions: - Ensure optional dependencies can be installed: npm install --include=optional sharp - Ensure your package manager supports multi-platform installation: See https://sharp.pixelplumbing.com/install#cross-platform - Add platform-specific dependencies: npm install --os=linux --cpu=x64 sharp - Consult the installation documentation: See https://sharp.pixelplumbing.com/install ----------------------------------- In the 'NPM packages' section, I see proper sharp package as shown in the attached image. It sees that installed package is not in the correct platform. How can I fix it. Thanks a lot
No description
AI Support
AI Support4mo ago
AI Support Bot Information
<@1071499588390883328> you can react on the relevant answer (message) with a ✅ in this thread when you think it has been solved, by the bot or by a human! Anyone can react on this message with a ❌ if the GPT bot is unhelpful or hallucinating answers. Please note: Team members will review and answer the questions on best efforts basis.
robot007
robot0074mo ago
@AI Support please explain the installation process where can I type in the commands, such as 'npm install --include=optional sharp'
Gaurav Chadha
Gaurav Chadha4mo ago
Hey @robot007, you can install npm package using named import methods - import any npm package using Named import declaration. Example: import module from "module-name"; &import Crypto from 'crypto'; Best way is to generate with AI - https://docs.buildship.com/ai-nodes
AI Generated Nodes – BuildShip
A unified resource to start building your backend with low-code. Dive into triggers, nodes, and step-by-step guidance to jumpstart your workflow creation.
robot007
robot0074mo ago
@Gaurav Chadha Dear Gaurav, thanks for your hint. I want to explain that I watched the video and search documentation before I asked question. I used BuildShip AI generated a node, and got the error I mentioned above. Could you provide more guidance. Thanks.
No description
robot007
robot0074mo ago
No description
robot007
robot0074mo ago
The above node was generated from this prompt:
No description
robot007
robot0074mo ago
@Gaurav Chadha could you please give some hints? Thanks.
Gaurav Chadha
Gaurav Chadha4mo ago
could you try using some other package? As this one requires additional dependency which is not supported to be imported in ES6 format eg: import name from package
robot007
robot0074mo ago
@Gaurav Chadha Thanks. It seems the Jimp package works.
dbrwk
dbrwk3mo ago
@Gaurav Chadha when i tried ai generate jimp node this error occures: { "nodeId": "test-node-1727500902127", "nodeName": "Resize and Change Image Quality", "stage": "building node", "errorObject": { "errors": [ { "id": "", "location": { "column": 7, "file": "../../../tmp/test-node-1727500902127XXXXXXOisBbE/index.ts", "length": 4, "line": 1, "lineText": "import Jimp from 'jimp';", "namespace": "", "suggestion": "" }, "notes": [], "pluginName": "", "text": "No matching export in "../../../tmp/test-node-1727500902127XXXXXXOisBbE/node_modules/jimp/dist/esm/index.js" for import "default"" } ], "warnings": [] } }
Szekeres Géza
Szekeres Géza3mo ago
same issue here.. tried with sharp first, than jimp, none of the worked, having the same error above @dbrwk did you find any solution? I'm looking for a simple thumbnailer anyhow guys, I made a node that works, feel free to use or customize: import jimp from "jimp"; export default async function addImageOverlay({ imageUrl, targetWidth = 320, quality = 75, outputFormat = 'jpeg' }: NodeInputs,{logging}: NodeScriptOptions) : NodeOutput { const image = await jimp.read(imageUrl); image.resize(targetWidth, jimp.AUTO).quality(quality); const mime = image.getMIME(); const base64String = await image.getBase64Async(mime); return base64String;
} All u need is to upload the bas64 return to your storage
dbrwk
dbrwk3mo ago
Good for you, @Szekeres Géza . I did not found any solution and just put that idea on hold. Will check your way in the future, thanks for sharing for the community!

Did you find this page helpful?