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

yarn seed outputs "Failed to move C:\test\demoMigration\data\uploads to public\uploads" #1

Open
MO-Lewis opened this issue Jan 3, 2023 · 2 comments

Comments

@MO-Lewis
Copy link

MO-Lewis commented Jan 3, 2023

Running Windows 10 64-bit, with node v14.18.2 and yarn v1.22.19

To reproduce:

  • git clone https://github.com/PaulBratslavsky/demoMigration.git
  • In the new folder, run yarn.
  • After that's completed, run yarn seed.

For me, this gives the error "Failed to move C:\test\demoMigration\data\uploads to public\uploads".

I'm not sure what else to do here, but I do notice that the "demoMigration\data\uploads" folder/file is never created, which is probably why it can't be moved to the "public\uploads" folder. I hope this helps!

@MO-Lewis
Copy link
Author

MO-Lewis commented Jan 3, 2023

Further investigation reveals that this is likely a Windows permission issue.
After adding a console.log() to get the raw err output, I get:

[Error: EPERM: operation not permitted, rename 'C:\test\demoMigration\data\uploads' -> 'C:\test\demoMigration\public\uploads'] {
  errno: -4048,
  code: 'EPERM',
  syscall: 'rename',
  path: 'C:\\test\\demoMigration\\data\\uploads',
  dest: 'C:\\test\\demoMigration\\public\\uploads'
}

Even running cmd as Administrator and resetting folder permissions doesn't fix the issue, so I'm unsure if this is a personal PC problem or a wider issue.

If some other Windows users can try this and confirm that it's not happening to them, I'll accept this as an issue on my side, and close the issue.

@MO-Lewis
Copy link
Author

MO-Lewis commented Jan 5, 2023

I was pretty confused why we were doing await fse.rename(uploadDataPath, uploadPath); in the seed.js file, but now I think this is a mistake within the code.

If I change that line to await fse.move(uploadDataPath, uploadPath, {overwrite: true});, the script runs completely as intended; all data and images successfully seed!

I'll make a PR if I have time; it's only a one-line fix anyway :)

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

No branches or pull requests

1 participant