Got: GOT require issue

Created on 23 Feb 2020  路  3Comments  路  Source: sindresorhus/got

Describe the bug

  • Node.js version: 8.17.0
  • OS & version: macos

Actual behavior

gives below error
/node_modules/got/dist/source/create.js:101
got.paginate = async function* (url, options) {
^

SyntaxError: Unexpected token *
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.
...

Expected behavior

console.log should print object information about got
...

Code to reproduce

const got = require('got');
console.log(got);

Checklist

  • [x] I have read the documentation.
  • [x] I have tried my code with the latest version of Node.js and Got.

Most helpful comment

as i see GOT works fine in node 12+ , in case got does not support older version on nodejs, then please highlight and mention it in the documentation.
this will save a lot of time of developer facing similar issue

All 3 comments

as i see GOT works fine in node 12+ , in case got does not support older version on nodejs, then please highlight and mention it in the documentation.
this will save a lot of time of developer facing similar issue

Got already indicates the required Node.js version in package.json

I ran the following command on 2 versions.

npm install -g bootprint
npm install -g bootprint-openapi
bootprint openapi http://petstore.swagger.io/v2/swagger.json target
bootprint openapi http://petstore.swagger.io/v2/swagger.json openapi

With node version v8.9.1, this is not working. With the node version v10.16.3 the above codes are working.
(
image )

Was this page helpful?
0 / 5 - 0 ratings