sideshowcoder / canned

Server to respond with fake API responses, by using a directory of files for finding out what to say!
213 stars 46 forks source link

Bug: ENOENT No such file or directory when installing with Yarn 1.0.1 on Windows #117

Closed sampsonjoliver closed 6 years ago

sampsonjoliver commented 6 years ago

Had this issue when installing canned with yarn 1.0.1 on Windows. I raised an issue over on Yarn and the issue was closed as being to fault with the canned package name.

What is the current behavior? error An unexpected error occurred: "https://registry.yarnpkg.com/canned/-/canned-0.3.9.tgz: ENOENT: no such file or directory, open 'C:\Users\samjo\AppData\Local\Yarn\cache\v1\npm-canned-0.3.9-b0bfdeffdc595dd5c0055730b808d5c26b4caa02\spec\test_responses\_a?name=Batman&age=30.get.html'".

Steps to reproduce. Running yarn add or in fact any yarn invocation after adding "canned": "^0.3.10" as a dev dependency to my package.json results in the error. Amending to use other versions of canned, e.g. 0.3.9 produce the same error.

Cause

this is noy Yarn's fault but a problem with the package itself. That file has ? in its name and that character is not allowed in file or folder names on Windows: https://support.microsoft.com/en-us/help/905231/information-about-the-characters-that-you-cannot-use-in-site-names--fo

All of this cited from the issue raised on the yarn github: https://github.com/yarnpkg/yarn/issues/4427

kumarharsh commented 6 years ago

It was solved (https://github.com/sideshowcoder/canned/issues/19) but came back?

sampsonjoliver commented 6 years ago

@kumarharsh hm yeah, looks like a similar issue.

It looks like the canned package comes with some test response files that have the issue in #19. When installing from yarn 1.0.1 it can't write those files so the whole install fails, whereas when I install from yarn 0.27.0 or from npm, then it writes those files by stripping the '?' characters from the file name.

For example, after installing with yarn 0.27.0 there is now a file correctly stored under the dir C:\Users\samjo\AppData\Local\Yarn\cache\v1\npm-canned-0.3.10-da022e457d5941423a9e29e7edc368f37ad629ff\spec\test_responses\_a_name=Batman&age=30.get.html

sampsonjoliver commented 6 years ago

Still happening on yarn 1.2.1 as well.

Due to the nature of this problem, I expect it's not going to go away, which is unfortunately making it very difficult to keep using canned while on a Windows machine.

sideshowcoder commented 6 years ago

I think the way to go here is to delete the files containing special characters (not supported on windows). Given that there is an alternative to those file names by including what currently is in the name of the file in the file itself the tests could be rewritten in such a way, and therefor enabling this to work on windows.

sideshowcoder commented 6 years ago

I tested it on Windows now using Yarn, and I could reproduce before the change, now

yarn add https://github.com/sideshowcoder/canned

works as expected.