VIKRAM V J
VIKRAM V J

Reputation: 1

How to solve this global is not defined problem?

This is the error image

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

Upvotes: 0

Views: 215

Answers (2)

iskandar47
iskandar47

Reputation: 301

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 .

Upvotes: 0

anuragsharma01
anuragsharma01

Reputation: 1

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.

Upvotes: 0

Related Questions