patrickjuchli / basic-ftp

FTP client for Node.js, supports FTPS over TLS, passive mode over IPv6, async/await, and Typescript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How can I get this to work on Windows

George-Brendan-Doyle opened this issue · comments

I have tried using webpack 5 and Parcel to build the new .js files.
The .js file before conversion works fine with node in the command prompt but I cannot get it to work in Windows (11). I am using the latest basic-ftp 5.0.4.
The error I get in the browser using Webpack or Parcel is ...
Uncaught TypeError: The "original" argument must be of type Function
at promisify (util.js:614:11)
at 5u8Fu.c4216f9df743e6cc (Client.js:17:38)
at newRequire (index.47c005a7.js:71:24)
at localRequire (index.47c005a7.js:84:35)
at 2uKas.b1c576accb3ceae3 (index.js:21:14)
at newRequire (index.47c005a7.js:71:24)
at localRequire (index.47c005a7.js:84:35)
at 8Duvb.44a9388bb99fc836 (index1.js:7:16)
at newRequire (index.47c005a7.js:71:24)
at index.47c005a7.js:122:5

The index1.js File I use is
// src/index1.js
// works with node index1.js but not with webpack
//import style from "./main.css";

console.log("Starting");
// see https://www.npmjs.com/package/basic-ftp
const Client = require("basic-ftp")
//import * as Client from "basic-ftp"

//console.log(Client);
example();

async function example() {
const client = new Client.Client()
client.ftp.verbose = true
try {
await client.access({
host: "somehost",
user: "username",
password: "password",
secure: false
})
console.log(await client.list())
//await client.uploadFrom("README.md", "README_FTP.md")
//await client.downloadTo("README_COPY.md", "README_FTP.md")
}
catch(err) {
console.log(err)
}
client.close()
}

//import ftp from "basic-ftp";
console.log("Finished!");

My package.json is as follows:

{
"name": "parcel-demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"source": "src/index.html",
"scripts": {
"start": "parcel",
"build": "parcel build"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"buffer": "^6.0.3",
"node": "^21.2.0",
"parcel": "^2.10.3"
},
"dependencies": {
"basic-ftp": "^5.0.4"
}
}

My npm list is as follows:

parcel-demo@1.0.0 C:\Users\georg\Documents\jscript\parcel-demo
+-- basic-ftp@5.0.4
+-- buffer@6.0.3
+-- node-bin-setup@1.1.3 extraneous
+-- node@21.2.0
`-- parcel@2.10.3

Any help would be appreciated.
Thanking you in advance - its a very good ftp for node.

The .js file before conversion works fine with node in the command prompt but I cannot get it to work in Windows (11).

What does this mean exactly? To me it sounds like this is not issue with this library but rather the build process you use.

Thanks for your quick response.
I know there seems to be a problem with the build process that's why I tried Parcel instead of Webpack - I thought they my handle the process differently.
I have researched the web extensively for a solution but to no avail.
I thought maybe one of your followers had managed a build process for windows and could steer me in the right direction.

I'm afraid this issue tracker is for bugs or feature requests concerning the library specifically. General questions around Node and Webpack/Parcel should be posted to something like Stackoverflow, you have a much better chance of finding an answer there.