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
Meteor 1.5-beta.16 and beta.17 showed 'ReferenceError: Buffer is not defined' client side #8645
Comments
This was a deliberate change! See this commit for details. If it's worth the additional 22KB of minified JS, you can import the global.Buffer = global.Buffer || require("buffer").Buffer; I would recommend at least finding out where you're using the |
Thank you for your great reply, some package in my project uses the |
For others who encounter this error, you can easily drop a breakpoint on the error in your browser's inspector, then refresh the page to hit the breakpoint and see via the call stack which package is trying to use |
Also - just to ease the transition for anyone else, you can put the polyfill in place here - it should load first
// this is an expensive polyfill for clientside Buffer usage
// but we recommend you refactor to remove this dependency
global.Buffer = global.Buffer || require("buffer").Buffer; // eslint-disable-line
// how to refactor
// you can easily drop a breakpoint on the error in your browser's inspector, then refresh the page to hit the breakpoint and see via the call stack which package is trying to use Buffer
// https://github.com/meteor/meteor/issues/8645 |
I thought the idea was that meteor would tell what packages are required on client. On 1.4.4.3 I'm getting this error after running update all packages. The polyfill doesn't help, but my vue stuff still runs. |
Getting the same here:
|
Reporting the problem again at this point is not helpful. Please see the workaround(s) described above. |
Sure, but due to my logs, this is caused by some main package (meteor-node-stubs). Above you told that any third party packages cause this error, so I've added my comment to ask if this is a core issue. // Edit: Didn't see that this issue was closed, sorry. |
That package (called Newly created apps don't use |
Hi ben you got me confused with
My application is crashing when trying to import crypto... I'm importing Buffer in another file for now (same file wouldn't work). From what I can understand from your sentence is that it shouldn't be doing that so I'm wondering what's wrong. |
@zeroasterisk's solution worked for me. The Winston NPM package was the dependent package. |
As of |
@benjamn |
Just to confirm that @benjamn 's solution worked for me as well. By simply updating Just in case, I'm using practicalmeteor:mocha. Thank you very much @benjamn for your post! :-D |
@ArnieGA did you do anything else to get your tests to run? The polyfill works when I run app normally but I still get the Buffer err when running the tests. Thoughts? |
Ok I fixed this. If anybody else is having this issue when running tests, add the polyfill to a new file |
Ok it doesn't matter if it's called init.js or whatever. The problem with me is that I've created a js file and the code there is not executed at all. |
I am getting this
Meteor 1.6.1 |
@maasha Are you getting it on the client? Do you have the |
|
Just for anyone in the future adding Vue to a migrated Meteor app, if |
my project works fine on Meteor 1.5-beta.14, when updated to Meteor 1.5-beta.16 and beta.17, the server side startup fine with no error, but when i open my site in chrome, an error showed up:
i wonder if i need to add some packages?
The text was updated successfully, but these errors were encountered: