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.
Does the .cache/gatsby-source-filesystem/ directory exist in your site?
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
@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/.
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:
Any thoughts on this or additional ideas?
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.
@Fetten Care to share a branch? :)
@justinwhall Sure :)
https://github.com/Fetten/gatsby/commit/dae56645aa67d7bd38c5d4c36e017d4b59a6b721
Most helpful comment
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.