Skip to content

node v4 error when using napi_versions/napi_build_versions #396

Open
@springmeyer

Description

@springmeyer

I found that if you add:

    "package_name": "{module_name}-v{version}-{platform}-{arch}-napi-v{napi_build_version}.tar.gz",
    "napi_versions": [
        1,
        2
    ]

To the package.json binary property of a node-pre-gyp enabled module it will lead to this error with node v4:

./node_modules/.bin/node-pre-gyp rebuild --loglevel=error
/Users/danespringmeyer/projects/node-sqlite3/node_modules/node-pre-gyp/lib/util/napi.js:105
			if (!napi_build_versions.includes(napi_version)) napi_build_versions.push(napi_version);
			                         ^

TypeError: napi_build_versions.includes is not a function

This looks to be because Array.includes is not supported with node v4, so we'll either need to use a polyfill or use Array.indexOf instead.

@jschlight two questions for you:

  • Should we try to support node v4 at all? If not, should this just throw with an easier to understand error?
  • If we should support node v4, do you have bandwidth to provide a PR to fix this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions