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

Error running in Node 5.9.1 #608

Closed
burnnat opened this issue Jun 13, 2018 · 4 comments
Closed

Error running in Node 5.9.1 #608

burnnat opened this issue Jun 13, 2018 · 4 comments
Labels

Comments

@burnnat
Copy link
Contributor

burnnat commented Jun 13, 2018

The package.json indicates that Node.js is supported back to version 4.2:

  "engines": {
    "node": ">=4.2.0"
  },

However, attempting to run with node 5.9.1 I get the following error:

TypeError: utf8 is not a function
    at Function.from (native)
    at Function.from (native)
    at updateOutput (C:\project\src\main\scripts\node_modules\ts-node\src\index.ts:559:28)
    at Object.compile (C:\project\src\main\scripts\node_modules\ts-node\src\index.ts:546:20)
    at Module.m._compile (C:\project\src\main\scripts\node_modules\ts-node\src\index.ts:430:43)
    at Module._extensions..js (module.js:422:10)
    at Object.require.extensions.(anonymous function) [as .ts] (C:\project\src\main\scripts\node_modules\ts-node\src\index.ts:433:12)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)

The problematic change appears to be this commit, as Buffer.from(string[, encoding]) was only introduced in Node 5.10.0.

@blakeembrey
Copy link
Member

Feel free to update the package.json 👍

@burnnat
Copy link
Contributor Author

burnnat commented Jun 13, 2018

Well given I'm locked into this version of node for the time being (not of my own choice), I was hoping there would be a way to maintain compatibility... 😐

That said, I'm happy to update the package.json if 5.9 is too old for support at this point.

@blakeembrey
Copy link
Member

blakeembrey commented Jun 15, 2018

You could replace Buffer.from with https://www.npmjs.com/package/buffer-from instead, if you'd like to submit that PR.

Edit: Unfortunately there's no type definition for it though.

@burnnat
Copy link
Contributor Author

burnnat commented Jun 16, 2018

I've submitted typings for buffer-from in DefinitelyTyped#26602 and will create a PR for the change here once they make it into NPM.

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

No branches or pull requests

2 participants