Cannot `require('ws')` #989

Closed
vidstige opened this Issue Feb 5, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@vidstige

vidstige commented Feb 5, 2017

I npm installed 2.0.2 and upon just issuing node -e "require('ws')" ws blows up with the following stacktrace.

I'm using node v4.2.6

/Users/vidstige/src/tumel/node_modules/ws/lib/PerMessageDeflate.js:8
const TRAILER = Buffer.from([0x00, 0x00, 0xff, 0xff]);
                       ^

TypeError: this is not a typed array.
    at Function.from (native)
    at Object.<anonymous> (/Users/vidstige/src/tumel/node_modules/ws/lib/PerMessageDeflate.js:8:24)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/vidstige/src/tumel/node_modules/ws/lib/WebSocket.js:16:27)
    at Module._compile (module.js:410:26)
@lpinca

This comment has been minimized.

Show comment
Hide comment
@lpinca

lpinca Feb 5, 2017

Member

Buffer.from() does not work on Node.js < 4.5.0. Is it possible for you to upgrade to a more recent version?

Member

lpinca commented Feb 5, 2017

Buffer.from() does not work on Node.js < 4.5.0. Is it possible for you to upgrade to a more recent version?

@vidstige

This comment has been minimized.

Show comment
Hide comment
@vidstige

vidstige Feb 5, 2017

Thanks for quick reply. I rather not, using port install nodejs to install which only has 4.3, but might consider later. I could perhaps also downgrade ws?

vidstige commented Feb 5, 2017

Thanks for quick reply. I rather not, using port install nodejs to install which only has 4.3, but might consider later. I could perhaps also downgrade ws?

@vidstige vidstige closed this Feb 5, 2017

@lpinca

This comment has been minimized.

Show comment
Hide comment
@lpinca

lpinca Feb 5, 2017

Member

Yes, you can use ws@1. It's a shame though as there are a lot of bug fixes in v2. Can I ask why you prefer port over brew? Homebrew has the latest Node.js 4 available at node@4.

$ brew info node@4
node@4: stable 4.7.3 (bottled), HEAD [keg-only]
Platform built on V8 to build network applications
https://nodejs.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/node@4.rb
Member

lpinca commented Feb 5, 2017

Yes, you can use ws@1. It's a shame though as there are a lot of bug fixes in v2. Can I ask why you prefer port over brew? Homebrew has the latest Node.js 4 available at node@4.

$ brew info node@4
node@4: stable 4.7.3 (bottled), HEAD [keg-only]
Platform built on V8 to build network applications
https://nodejs.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/node@4.rb
@vidstige

This comment has been minimized.

Show comment
Hide comment
@vidstige

vidstige Feb 6, 2017

No, I like ports more. It does have node, but inside another package called node4. But I'll go with that anyway. Thanks fro your help! :)

vidstige commented Feb 6, 2017

No, I like ports more. It does have node, but inside another package called node4. But I'll go with that anyway. Thanks fro your help! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment