fs-extra version:error line:
https://github.com/jprichardson/node-fs-extra/blob/master/lib/copy-sync/copy-sync.js#L121
function copyDirItem stat.checkPathsSync should be use fs.lstatSync when options:dereference is false
quick fix
util/stat.js:getStatsSync
function getStatsSync (src, dest, opts = {}) {
let srcStat, destStat
const statSync = opts.dereference ? fs.statSync : fs.lstatSync
if (nodeSupportsBigInt()) {
srcStat = statSync(src, { bigint: true })
} else {
srcStat = statSync(src)
}
try {
if (nodeSupportsBigInt()) {
destStat = statSync(dest, { bigint: true })
} else {
destStat = statSync(dest)
}
} catch (err) {
if (err.code === 'ENOENT') return { srcStat, destStat: null }
throw err
}
return { srcStat, destStat }
}
@manidlou Can you take a look at this?
Sure thing!
@lljxx1 can you give us a reproducible test case please?
fundembp:alternatives fun$ ls -l
total 0
lrwxr-xr-x 1 fun staff 31 2 24 09:57 phar -> /code/.fun/root/usr/bin/phar7.0
lrwxr-xr-x 1 fun staff 47 2 24 09:57 phar.1.gz -> /code/.fun/root/usr/share/man/man1/phar7.0.1.gz
lrwxr-xr-x 1 fun staff 36 2 24 09:57 phar.phar -> /code/.fun/root/usr/bin/phar.phar7.0
lrwxr-xr-x 1 fun staff 52 2 24 09:57 phar.phar.1.gz -> /code/.fun/root/usr/share/man/man1/phar.phar7.0.1.gz
lrwxr-xr-x 1 fun staff 30 2 24 09:57 php -> /code/.fun/root/usr/bin/php7.0
lrwxr-xr-x 1 fun staff 34 2 24 09:57 php-cgi -> /code/.fun/root/usr/bin/php-cgi7.0
lrwxr-xr-x 1 fun staff 38 2 24 09:57 php-cgi-bin -> /code/.fun/root/usr/lib/cgi-bin/php7.0
lrwxr-xr-x 1 fun staff 50 2 24 09:57 php-cgi.1.gz -> /code/.fun/root/usr/share/man/man1/php-cgi7.0.1.gz
lrwxr-xr-x 1 fun staff 46 2 24 09:57 php.1.gz -> /code/.fun/root/usr/share/man/man1/php7.0.1.gz
here is the example, the /code folder is not exists
I've encounted this issue as well.
Online demo reproducing the issue: https://repl.it/repls/OvalCruelApplets
As a quick workaround to anyone who also found this issue but doesn't want to patch node modules locally, https://www.npmjs.com/package/ncp seems to be a fine alternative for copy.
With that said, it seems the fix was just merged into v10, so hopefully this should be closed out soon! :)
Most helpful comment
I've encounted this issue as well.
Online demo reproducing the issue: https://repl.it/repls/OvalCruelApplets