#2054·browserify

SyntaxError: Unexpected token (53:4) while parsing

Author: paulcoffee85Created Mar 13, 2023Updated Jul 21, 2025

The error whenever trying to use command:

$ yarn browserify index.js --standalone bundle -o ./dist/bundle.js with file that has const { ethers } = require("ethers"); in it. Otherwise how do you add that require after process if possible ??

$ C:\Users\paulc\ConnectSmartContracts2MM\node_modules\.bin\browserify index.js --standalone bundle -o ./dist/bundle.js
SyntaxError: Unexpected token (53:4) while parsing C:\Users\paulc\ConnectSmartContracts2MM\node_modules\ethers\lib.commonjs\abi\fragments.js while parsing file: C:\Users\paulc\ConnectSmartContracts2MM\node_modules\ethers\lib.commonjs\abi\fragments.js
    at DestroyableTransform.end [as _flush] (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\insert-module-globals\index.js:114:21)
    at DestroyableTransform.prefinish (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:138:10)
    at DestroyableTransform.emit (node:events:513:28)
    at prefinish (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:619:14)
    at finishMaybe (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:627:5)
    at endWritable (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:638:3)
    at Writable.end (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_writable.js:594:22)
    at DestroyableTransform.onend (C:\Users\paulc\ConnectSmartContracts2MM\node_modules\through2\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:627:28)
    at DestroyableTransform.emit (node:events:525:35)