Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The file doesn't exist, even though it does #72

Closed
anogr opened this issue Dec 6, 2019 · 5 comments · Fixed by #75
Closed

The file doesn't exist, even though it does #72

anogr opened this issue Dec 6, 2019 · 5 comments · Fixed by #75
Labels

Comments

@anogr
Copy link

anogr commented Dec 6, 2019

If I try to copy a folder using cpy-cli, I get an error message saying the file doesn't exist. The "file" is a folder, and it does exist.

The error is in index.js, line 81. I don't know the intent of the check
!sourcePaths.every(value => files.includes(value))
but that's the reason it fails.

That check was added September 22.

@sindresorhus
Copy link
Owner

// @whitecrownclown

@smileLilith
Copy link

smileLilith commented Dec 8, 2019

I've faced the same issue when I've tried to copy directory that exists in v8.0.0.

(node:35974) UnhandledPromiseRejectionWarning: NestedError: Cannot copy `node_modules/@fortawesome/fontawesome-free/webfonts`: the file doesn't exist
    at promise (/<my-project-path>/node_modules/cpy/index.js:76:10)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:35974) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:35974) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Downgrading to v7.3.0 fix the issue.

@whitecrownclown
Copy link
Contributor

whitecrownclown commented Dec 9, 2019

// @sindresorhus

The issue introduced here is that we cannot differentiate between folders & files without reading the fs. (afaik)

The !sourcePaths.every(value => files.includes(value)) check would verify the returned files from globby with the provided source (excluding globs). However, directories are listed in the source, but not in the files output and the check would fail.

I think we should revert to only throwing an error when files.length === 0 && !hasGlob(source).

@taion
Copy link

taion commented Feb 13, 2020

ref #74 – that check had some other problems, too

@sindresorhus
Copy link
Owner

@whitecrownclown Yeah, lets do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants