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

Error: Failed find: ENOENT: no such file or directory, stat '<myFrontendDirectory>\node_modules\.pnpm\chokidar@2.1.8\node_modules\fsevents' #13688

Closed
mitoihs opened this issue Oct 9, 2020 · 6 comments · Fixed by #13834

Comments

@mitoihs
Copy link

mitoihs commented Oct 9, 2020

Required Information

Question, Bug, or Feature?
Type: Bug

Enter Task Name: FileTransform

Environment

  • Agent - Hosted or Private:

    • If using private agent, provide the OS of the machine running the agent and the agent version: Windows, 2.168.2

Issue Description

FileTransform task ends immediately with an error:
Error: Failed find: ENOENT: no such file or directory, stat '\node_modules.pnpm\chokidar@2.1.8\node_modules\fsevents'

I use pnpm which seems to be important there. It creates symbolic links and in case of that particular link - it is broken (leads to nonexisting file). Still, my configuration of FileTransform task is:

displayName: Update config
  inputs:
    folderPath: $(<myFrontendDirectory>)
    jsonTargetFiles: config.json

so I'd expect that task to just touch that single file and not iterate over everything under folderPath. Even if that error won't cause that task to fail, it is still a big waste of time to enumerate every single file, especially under node_modules.

Is there a simple workaround to make it work without having to delete node_modules or moving config.json somewhere else?

Error logs

##[error]Error: Failed find: ENOENT: no such file or directory, stat '\node_modules.pnpm\chokidar@2.1.8\node_modules\fsevents'

@AmrutaKawade
Copy link
Contributor

@mitoihs Can you try giving more specific path for the file which you want to transform. Wildcards in path are supported.

@AmrutaKawade AmrutaKawade self-assigned this Oct 16, 2020
@mitoihs
Copy link
Author

mitoihs commented Oct 16, 2020

Hi @AmrutaKawade! Yeah, sure.
My project layout is like:

  • myFrontendDirectory/
    • src/
      • all the source code...
    • package.json
    • config.json
    • node_modules/ is also on that level

and for the task I provide

displayName: Update config
  inputs:
    folderPath: myFrontendDirectory
    jsonTargetFiles: config.json

so my path doesn't have any wildcards.

I've read sources of FileTransform task and the way it searches for file(s) to transform and it seems like it will at first go through everything under folderPath and after that it tries to match jsonTargetFiles to every single file it found. In my case it's failing while going through node_modules because there's a broken symbolic link inside (and that's ok for me, it's just a link for unnecessary optional dependency pnpm has created).

I've used a "workaround" by moving config.json inside src and giving folderPath: myFrontendDirectory/src so node_modules aren't enumerated this way and it works for me. Still I had to read the sources of that task to know what's going on and how to avoid that bug.

I think that a "quickfix" for that bug would be to "short-circuit" the path if there are no wildcards inside and just go fetch that single file instead of enumerating anything.
But a proper, beautiful fix should include a rework of how it searches for files by examining folderPath and jsonTargetFiles and only enumerating directories it has to enumerate in order to find all matching files. It will work much faster then.

@AmrutaKawade
Copy link
Contributor

AmrutaKawade commented Oct 30, 2020

what version of pnpm are you using? I am not able to repro this issue. also its fetching directly single file and not iterating over each file of folder. Can you share repro steps?

@mitoihs
Copy link
Author

mitoihs commented Nov 3, 2020

Hi! I use pnpm at highest available version (5.10.4) but it doesn't seem to matter.

I've created a repository with minimum code required to reproduce the issue:
https://github.com/mitoihs/FileTransformErrorRepro

azure-pipelines.yml is included, please create a pipeline with it in Azure DevOps and check it out .

@AmrutaKawade AmrutaKawade linked a pull request Nov 3, 2020 that will close this issue
2 tasks
@AmrutaKawade
Copy link
Contributor

Thanks for repro. It really helped

@AmrutaKawade
Copy link
Contributor

this is fixed and will be deployed within 2 weeks

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

Successfully merging a pull request may close this issue.

3 participants