ssh2 icon indicating copy to clipboard operation
ssh2 copied to clipboard

example/sftp-server-download-only.js cannot read property 'OPEN_MODE' of undefined

Open avstri opened this issue 3 years ago • 4 comments

checked out the project yarn add ssh2 cd example node sftp-server-download-only.js

getting error 'Cannot read property 'OPEN_MODE' of undefined'

node version is 12.22.2

image

Please advise...

avstri avatar Sep 01 '22 23:09 avstri

Try utils: { sftp: ... }

mscdex avatar Sep 02 '22 00:09 mscdex

that worked, thank you! please update your example.

avstri avatar Sep 02 '22 00:09 avstri

I changed to this: const { Server, utils: {sftp: { OPEN_MODE, STATUS_CODE, }}, } = require('ssh2');

But it is the new error: `new ssh2.Server({ ^

ReferenceError: ssh2 is not defined`

What is wrong?

SantyTaco avatar Nov 17 '22 23:11 SantyTaco

@SantyTaco remove the 'ssh2.' before 'Server'. The var 'Server' doesn't need the package name at this point. I don't know enough about JS to guess how that got there.

KCJwhite avatar Dec 09 '22 16:12 KCJwhite