A few hrs ago I started receiving the following message that goes away when I comment out the line that imports the @solana/spl-token:

_stream_writable.js:57 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'slice')
    at node_modules/readable-stream/lib/_stream_writable.js (_stream_writable.js:57:81)
    at __require2 (chunk-MXXBJFJ4.js?v=1532b7aa:27:50)
    at node_modules/readable-stream/readable-browser.js (readable-browser.js:4:20)
    at __require2 (chunk-MXXBJFJ4.js?v=1532b7aa:27:50)
    at node_modules/browserify-sign/browser/index.js (index.js:5:14)
    at __require2 (chunk-MXXBJFJ4.js?v=1532b7aa:27:50)
    at node_modules/crypto-browserify/index.js (index.js:39:12)
    at __require2 (chunk-MXXBJFJ4.js?v=1532b7aa:27:50)
    at splDiscriminate.ts:1:28

Version "@solana/spl-token": "^0.4.6",

It was installed already and working, then started throwing this error a while a ago.

Update: Downgrading to version " "@solana/spl-token": "^0.1.8"," makes the problem gow away and the page loads, but that version doesn't export the functionality I was testing from the guides. e.g. getAssociatedTokenAddressSync

1 Answer 1


Update/Temporary Solution:

In Chrome, I was getting a more specific error:

Error Syntax in Google Chrome (previous ws in Brave)

Following the provided links I was able to put a breakpoint in the line 11378 (1st link in the error trace) and noticed the browser and version where always undefined, but the process contained information ab out my local environment and vite config.

Line Triggering the error

enter image description here

enter image description here

Then, I searched for several process.browser in each of the files 9 search in folder ) and found this usage:

process.browser usage


Then, on vite.config.js


    define: {
        "process.env": process.env,
        //"process.env.version" : '3.5',
        "process.browser": true,
        // // By default, Vite doesn't include shims for NodeJS/
        // // necessary for segment analytics lib to work
        //"Buffer": Buffer,
        global: {},


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.