Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
avstri opened this issue Sep 1, 2022 · 4 comments

Comments

@avstri
Copy link

avstri commented Sep 1, 2022

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...

@mscdex
Copy link
Owner

mscdex commented Sep 2, 2022

Try utils: { sftp: ... }

@avstri
Copy link
Author

avstri commented Sep 2, 2022

that worked, thank you! please update your example.

@SantyTaco
Copy link

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?

@KCJwhite
Copy link

KCJwhite commented Dec 9, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants