amzn / style-dictionary

A build system for creating cross-platform styles.
https://styledictionary.com
Apache License 2.0
3.94k stars 558 forks source link

ReferenceError: TransformStream is not defined #1304

Open Dannom opened 3 months ago

Dannom commented 3 months ago

Hey, Ive been trying to use the build cli command but keep getting this error:

/ILPETDAOM/AppData/Roaming/nvm/v14.15.5/node_modules/style-dictionary/node_modules/@zip.js/zip.js/lib/core/streams/crc32-stream.js:33 class Crc32Stream extends TransformStream { ^

ReferenceError: TransformStream is not defined at file:///C:/Users/ILPETDAOM/AppData/Roaming/nvm/v14.15.5/node_modules/style-dictionary/node_modules/@zip.js/zip.js/lib/core/streams/crc32-stream.js:33:27 at ModuleJob.run (internal/modules/esm/module_job.js:152:23) at async Loader.import (internal/modules/esm/loader.js:166:24) at async Object.loadESM (internal/process/esm_loader.js:68:5)

has anyone ever faced this? thanks

adamstankiewicz commented 2 months ago

I believe this is likely due to running style-dictionary with an older, unsupported version of Node.

Note the main branch defines the minimum supported Node version as >=18.0.0 (source), but per your error trace output above, it appears you're running Node v14 via nvm (Node Version Manager).

Try doing node -v to output your current Node version to verify. The fix would be to try switching to Node 18+ (e.g., nvm use 18).