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

[gatsby-source-wordpress] After adding wordpress plugin, gatsby develop throws error #3562

Closed
qdupendra opened this issue Jan 17, 2018 · 7 comments
Assignees

Comments

@qdupendra
Copy link

qdupendra commented Jan 17, 2018

I have created a new trial project with gatsby-bootstrap starter and installed gatsby-source-wordpress plugin as instructed with all the wp plugin configuration/credentials etc.

When trying to build or develop the project to check it in the browser, it throws an error and won't compile.

The error log is as followed:

error UNHANDLED EXCEPTION

Error: ENOENT: no such file or directory, rename '/Volumes/Data/WebsiteProjects/GatsbyWordpress/.cache/gatsby-source-filesystem/tmp-e8c2ad91b6179055d0ae09c526e48078.jpg' -> '/Volumes/Data/WebsiteProjects /GatsbyWordpress/.cache/gatsby-source-filesystem/e8c2ad91b6179055d0ae09c526e48078.jpg'

- Error

- index.js:27 tryRenameSync [GatsbyWordpress]/[fs-extra]/lib/move-sync/index.js:27:19

- index.js:22 Object.moveSync [GatsbyWordpress]/[fs-extra]/lib/move-sync/index.js:22:3

- create-remote-file-node.js:101 DuplexWrapper.<anonymous> [GatsbyWordpress]/[gatsby-source-filesystem]/create-remote-file-node.js:101:22

- next_tick.js:74 _combinedTickCallback internal/process/next_tick.js:74:11

- next_tick.js:98 process._tickCallback internal/process/next_tick.js:98:9

This error occurs after wordpress plugin has finished fetching pages, posts, comments etc.

I have built and used develop command to start the local server with the site successfully before I installed the wordpress plugin, after which, I cannot finish the build process.

Please help me resolve this issue.

Thanks.

@KyleAMathews
Copy link
Contributor

Does the .cache/gatsby-source-filesystem/ directory exist in your site?

@qdupendra
Copy link
Author

Yes, the directory exists and has many items in it, but I couldn't find the said item in the directory, hence the error. I don't know how to go about it

@radenb
Copy link

radenb commented Jan 22, 2018

@qdupendra I ran into a similar issue. The error ended up being caused by an image that had been duplicated in media. It was the same image with the same name for both instances. Upon deleting both versions and re-uploading it seemed to fix the error.

Hope this helps.

Edit: A little more information, my issue was caused because the same image was uploaded under 2 different users 12 months apart and for some reason all my uploads were being uploaded into /uploads/2016/.

@Fetten
Copy link
Contributor

Fetten commented Jan 26, 2018

I also had this issue recently on a multi-language WordPress site, which uses Polylang Pro as translation plugin.

Polylang creates an additional database entry (= post) for every image translation, but doesn't duplicate the image file itself. So gatsby-source-wordpress receives e.g. 3 entities from the REST api, which all point to the same image file.

I think the problem could might be in gatsby-source-filesystem's image creation in create-remote-file-node. After downloading the image with a temporary file name, it renames this file to a non temporary name. The next process with the same file can't proceed, because the tmp file is already deleted.

I haven't really worked through gatsby-source-filesystem, but could think of the following solutions:

  • check if a filename already exists
  • keep track of already downloaded files and skip multiple creations

Any thoughts on this or additional ideas?

@fk fk added the API/Plugins label Jan 31, 2018
@Fetten
Copy link
Contributor

Fetten commented Jan 31, 2018

Ok, I have a PR ready for this, which checks for duplicate media files.
Just waiting for the new normalizer PR to get merged before adding it.

@justinwhall
Copy link

@Fetten Care to share a branch? :)

@Fetten
Copy link
Contributor

Fetten commented Feb 3, 2018

@justinwhall Sure :)
Fetten@dae5664

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

Successfully merging a pull request may close this issue.

7 participants