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

ReferenceError: Buffer is not defined in tools.js #25

Open
elsmr opened this issue Mar 25, 2019 · 3 comments
Open

ReferenceError: Buffer is not defined in tools.js #25

elsmr opened this issue Mar 25, 2019 · 3 comments

Comments

@elsmr
Copy link

elsmr commented Mar 25, 2019

ReferenceError: Buffer is not defined
    at Object.writeVint (tools.js:44)
    at Object.encodeTag (tools.js:26)
    at EBMLEncoder.push.../../node_modules/ts-ebml/lib/EBMLEncoder.js.EBMLEncoder.writeTag (EBMLEncoder.js:55)
    at EBMLEncoder.push.../../node_modules/ts-ebml/lib/EBMLEncoder.js.EBMLEncoder.encodeChunk (EBMLEncoder.js:29)

I have this issue on web, my build system is based on TypeScript 2.9.2, relevant lines from tsconfig:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "target": "es5",
    "lib": ["es2017", "dom"],
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true
  }
}

For now I can work around it by setting Buffer on window.

import { Buffer } from 'buffer';
window.Buffer = Buffer;
@aponski
Copy link

aponski commented May 12, 2020

I have the same problem "typescript": "~3.7.5"

@mtycholaz
Copy link

Same problem, I ended up using your workaround and now everything works. It's because this library calls one of the functions from the original NodeJs library (which expects the Buffer type)

@alex-coda-13
Copy link

Same problem for me, but I think the solution cannot replace all new Buffer(...) in tool.ts of the library. Any update on this ?

instructure-gerrit pushed a commit to instructure/canvas-lms that referenced this issue Jul 6, 2022
See legokichi/ts-ebml#25

This is not a great fix, or a good place to put the fix; we're just
putting in a workaround so we can get Canvas deployed. Once ARC-8398 is
understood and resolved, we should revert this PS.

Change-Id: I4d71ecc32b76105dcdcfb12c2de4b062d1ca48a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295603
Tested-by: Service Cloud Jenkins <[email protected]>
Product-Review: Weston Dransfield <[email protected]>
Reviewed-by: Weston Dransfield <[email protected]>
QA-Review: Weston Dransfield <[email protected]>
instructure-gerrit pushed a commit to instructure/canvas-lms that referenced this issue Jul 6, 2022
See legokichi/ts-ebml#25

This is not a great fix, or a good place to put the fix; we're just
putting in a workaround so we can get Canvas deployed. Once ARC-8398 is
understood and resolved, we should revert this PS.

Change-Id: I4d71ecc32b76105dcdcfb12c2de4b062d1ca48a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/295603
Tested-by: Service Cloud Jenkins <[email protected]>
Product-Review: Weston Dransfield <[email protected]>
Reviewed-by: Weston Dransfield <[email protected]>
QA-Review: Weston Dransfield <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants