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

[1.1.6] Buffer.alloc is not a function #20

Closed
collenbrecht opened this issue May 11, 2017 · 15 comments
Closed

[1.1.6] Buffer.alloc is not a function #20

collenbrecht opened this issue May 11, 2017 · 15 comments
Assignees

Comments

@collenbrecht
Copy link

TypeError: Buffer.alloc is not a function
in create-hmac@1.1.6/legacy.js

@calvinmetcalf
Copy link
Contributor

this may be a bundling error, buffer refers to var Buffer = require('safe-buffer').Buffer and safe-buffer should have alloc on it

@briansneddon
Copy link

briansneddon commented May 12, 2017

I think one of the issues is that safe-buffer requires the buffer package however since buffer is not specified in the safe-buffer package.json there's no constraint on the version that will satisfy it. So if another package is already using an older buffer release then safe-buffer won't pull a later one. Some of the older buffer packages releases do not support alloc.

@mikew
Copy link

mikew commented May 12, 2017

I'm not sure where it's coming from for me yet, but it's happening with browserify for me.

@collenbrecht
Copy link
Author

we circumvented the issue by putting https://github.com/crypto-browserify/pbkdf2 fixed to an older version (3.0.9) as well as createHmac to version 1.1.4. Since then package 3.0.12 of pbkdf2 has been published but I still seem to get the same error when I unfix the versions.

@dcousens
Copy link
Member

Does anyone have easy repro steps?

@daaain
Copy link

daaain commented May 12, 2017

If you paste the code sample from the README to RequireBin you'll get the Buffer error on the console, see: http://requirebin.com/?gist=ea94116908e96710a648ad3f47407636

Edit: sorry, just realised this might be a different issue, will see if I can find a better way to reproduce the actual one...

@calvinmetcalf
Copy link
Contributor

jspm/registry#1049 seems to be the fix

@calvinmetcalf
Copy link
Contributor

@briansneddon opened an issue based on your thing on safe-buffer feross/safe-buffer#9

@s890081tonyhsu
Copy link

s890081tonyhsu commented May 16, 2017

I have the same issue at my repo, so I refer from here to wait for your next updates.

@nikashitsa
Copy link

nikashitsa commented May 16, 2017

I have same issue with old browserify (^6.3.2). Fixed with latest browserify (13.0.1)

@ilovett
Copy link

ilovett commented May 16, 2017

workaround is to use shrinkwrap

cd node_modules/browserify/node_modules/crypto-browserify
npm install pbkdf2@3.0.9
npm install create-hmac@1.1.4
cd ../../../../
npm shrinkwrap --dev

hopefully you dont run into any shrinkwrap errors... if so try npm prune

@jreading
Copy link

Are there fixes in those packages that should be PR'd?

@calvinmetcalf
Copy link
Contributor

there is a pull on safe-buffer feross/safe-buffer#10

@minwan
Copy link

minwan commented May 23, 2017

ETA for the fix? thanks!

@dcousens
Copy link
Member

Closing in favour of feross/safe-buffer#10

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

No branches or pull requests