on ‎2023 Jan 30 8:37 PM
Hi,
I am trying to use a node.js module (jsftp) in my BAS Project that did not come in on the template generator. I have added it via the terminal with this command: npm install jsftp --save-dev This ends up adding it to the package.json devDependencies section:

I can also see the folder in the project's node_modules folder, and everything seems fine.

Now, when I'm in my controller code, I would expect to be able to use this library. I've tried putting it in the sap.ui.define list at the start of the controller. I've tried that with "jsftp", "../node_modules/jsftp", etc but it does not work.

When I load the page, it errors with a 404-NotFound message of

This happens in various forms no matter what I put in the define section. The same thing happens is I do jQuery.sap.require("jsftp"). I've run npm install and that also does not seem to help anything.
I just can't find a way to utilize in my controller module a library that is added via an node.js module. I apologize for what seems like it should be a simple question, but I've been looking for the answer for several days and can not find anything that works.
Thanks,
Jeff
Request clarification before answering.
This is probably because your UI5 application does not really run as a server app which is usually where node_module packages are used. There are ways to incorporate an NPM module if you make some adjustments to the UI5.yaml file as laid out in this blog: https://blogs.sap.com/2021/11/15/using-npm-packages-in-ui5-without-shims/
Alternatively you can include the minified JS file as a third party dependency. You register it in the manifest file under JS resources
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.