If fs.cpSync copied a framework but its symlinks still point into a cache, check the options used for the copy. Node.js documents dereference as false by default, so a default copy preserves links rather than copying the files they reference. To request copies of the targets, set dereference: true. The exact cause still depends on the Node.js version, the actual options, and the source and destination layout.
Why the copied framework still points to the cache
By default, fs.cpSync copies symlinks as symlinks. That means the destination can contain a link whose target is still a cache path rather than a copied file. The Node.js File system API documentation describes dereference as “dereference symlinks. Default: false.”
As an Amazon Associate I earn from qualifying purchases.
This explains the result if the call omitted dereference or set it to false; the title alone does not establish what options were passed or which Node.js version ran the copy.
Copy the symlink targets instead
Set dereference: true in the options passed to fs.cpSync. If you are copying a directory tree, use recursive: true as well:
#1 Best Overall
- Get NVMe solid state performance with up to 1050MB/s read and 1000MB/s write speeds in a portable, high-capacity drive(1) (Based on internal testing; performance may be lower depending on host device & other factors. 1MB=1,000,000 bytes.)
- Up to 3-meter drop protection and IP65 water and dust resistance mean this tough drive can take a beating(3) (Previously rated for 2-meter drop protection and IP55 rating. Now qualified for the higher, stated specs.)
- Use the handy carabiner loop to secure it to your belt loop or backpack for extra peace of mind.
- Help keep private content private with the included password protection featuring 256‐bit AES hardware encryption.(3)
- Easily manage files and automatically free up space with the SanDisk Memory Zone app.(5). Non-Operating Temperature -20°C to 85°C
const fs = require('node:fs');
fs.cpSync(sourcePath, destinationPath, {
recursive: true,
dereference: true,
});
The paths in this example are variables in your program; replace them with the source and destination you intend to copy. The dereference option requests that Node follow symlinks when copying. recursive controls copying a directory tree; it does not enable dereferencing by itself.
Check what happened before changing the copy
- Confirm the runtime: run
node --versionin the same environment that performs the copy. Node.js addedfs.cpSyncin v16.7.0; it ceased to be experimental in v22.3.0, according to the API documentation. - Inspect the literal options: verify that the call actually passes
dereference: trueand, when copying a directory,recursive: true. Check wrappers or helper functions that may construct the options object. - Inspect the link and its target: determine whether the source link is relative or absolute, where it resolves before copying, and where that same link resolves from the destination. A preserved relative link may resolve differently when the directory layout changes; an absolute link can continue pointing to its original location.
- Check the destination contents: determine whether the destination entry is itself a symlink or a regular file or directory. This distinguishes preserving a link from copying its target.
Choose whether the destination should preserve links
| Desired result | Setting | Effect |
|---|---|---|
| Keep the symlink | dereference: false (the documented default) |
The destination retains a link rather than copying the target. |
| Copy the target through the symlink | dereference: true |
Requests that Node follow the symlink when copying. |
verbatimSymlinks is a different option. The API documents its default as false; it controls whether path resolution for symlinks is skipped. It is not a substitute for dereference: true.
Rank #2
- Solid state performance with up to 800MB/s read speeds in a portable drive. (Based on internal testing; performance may be lower depending on host device, interface, usage conditions and other factors. 1MB=1,000,000 bytes.)
- Back up your content and memories on a storage solution that fits seamlessly into your mobile lifestyle.
- Take it with you on your adventures—up to two-meter drop protection means this durable drive can take a beating. (Based on internal testing.)
- Secure it to your belt loop or backpack for extra peace of mind thanks to the tough rubber hook.
- From Sandisk, a brand professional photographers trust to take on assignments.
If dereference: true still leaves a link
A report in Node.js issue #59168 describes a caller on Node v22.17 seeing a destination symlink despite using { dereference: true, recursive: true }. That is a version-specific report, not proof that every v22.17 copy behaves that way or that it explains this case. The report does not establish a resolved status or affected-version range.
If you can reproduce the result with those options, record the exact Node version, source and destination layout, symlink type and resolved target, and a minimal copy example. Those details help distinguish an option or layout mismatch from a runtime-specific problem.
Rank #3
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Do not confuse filesystem copying with module-loader flags
Node’s --preserve-symlinks and --preserve-symlinks-main flags affect module loading and path resolution; they do not configure fs.cpSync and will not make a filesystem copy follow symlink targets. The Node.js CLI documentation also warns that loading linked native modules from multiple locations can cause them to be treated as separate modules and fail to load. Consider these flags only when diagnosing module-resolution behavior, not as a repair for copied links.
Quick Recap
Best Value
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Rank #4
- NEARLY 2X FASTER THAN OUR PREVIOUS GENERATION(8) – move 1,000 high-res photos in under 60 seconds(6) with up to 2000MB/s transfer speeds(2).
- IP65 RATING AND UP TO 3M DROP PROTECTION(3) – protects against spills and drops.
- POCKET-SIZED – fits easily in pockets and small bags.
- SPACE TO OWN YOUR AI CONTENT – speed and capacity to download your high-res clips and photo edits.
- 256-BIT AES ENCRYPTION(4) – helps keep private files secure with password protection.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




