Skip to content

test/crypto_ig.js error: Identifier 'Buffer' has already been declared #1977

@gabylb

Description

@gabylb

npm test of current latest browserify v16.5.2 fails in:

Subtest: test/crypto_ig.js
# Subtest: crypto --insertGlobals
1..2
Error: Parsing file /tmp/browserify/node_modules/asn1.js/lib/asn1/base/buffer.js: Identifier 'Buffer' has already been declared (6:6)

Same failure with Node.js v12.16.1 and v14.4.1 on Linux, and v14.9.0 on Windows.

It can be reproduced with:

git clone git@github.com:browserify/browserify.git
cd browserify
npm i
echo 'require("crypto")' > main.js
node bin/cmd.js main.js --ig

I can workaround the failure by commenting out this line:
const Buffer = require('safer-buffer').Buffer;
in:
node_modules/asn1.js/lib/asn1/decoders/pem.js
node_modules/asn1.js/lib/asn1/encoders/der.js
node_modules/asn1.js/lib/asn1/base/buffer.js

I didn't find this issue reported, so wondering if it's expected/known or an issue with my environment or Node.js version.
Thanks in advance.

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