I’m working on a project and suddenly caught this error , I don’t know where the error came from and it didn’t have any information, please help me
<script>
var global = global || window;
var Buffer = Buffer || [];
var process = process || {
env: {
DEBUG: undefined
},
version: []
};
</script>
I find this solution on GitHub and tried ,but it didn’t work , please someone help
2
Answers
The error might be occurring because the Buffer variable is being assigned an array, which is not its intended usage. Buffer is typically used in Node.js for handling binary data. In a browser environment, you typically wouldn’t need to define it.
And, the process variable is typically only available in Node.js environments and not in browsers.
The error says it all,
global is not defined
!in this line :
var global = global || window;
you are assigning the undefined
global
to the variable global, that’s your mistake .