TypeError: jsftp_1.default is not a constructor
jimfilippou opened this issue · 1 comments
jimfilippou commented
exports.Ftp = new jsftp_1.default({
^
TypeError: jsftp_1.default is not a constructor
at Object.<anonymous> (C:\Users\Jim\Desktop\backend\deploy\dist\index.js:4:15)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
jimfilippou commented
I came across this issue today and I found a solution. If you are using typescript, you should follow typescript rules, so you can't use import jsftp from 'jsftp';
. You must use import * as jsftp from 'jsftp';
instead.
my tsconfig.json is the following
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": false,
"noImplicitAny": false,
"module": "commonjs",
"target": "es2015"
}
}
Since this issue is fixed for typescript guys, i'm closing the issue.