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

Unable to copy site files to .cache Source and destination must not be the same. #32354

Closed
2 tasks done
sudhyr opened this issue Jul 13, 2021 · 6 comments
Closed
2 tasks done
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@sudhyr
Copy link

sudhyr commented Jul 13, 2021

Preliminary Checks

I've seen similar issues reported, but no solutions.

What I have found so far..

  • it works after deleting .cache folder
  • It works in gatsby 2

I'm assuming there is something wrong in my package version or node version. Any ideas on where to look.

Description

Brand new gatsby new starter project. gatsby develop fails to start the second time. I've tried other starters minimal gatsby 3 starters, same result.

Reproduction Link

https://github.com/rihdus/bug-gstarter

Steps to Reproduce

  1. npx gatsby new gs
  2. cd gs
  3. yarn start
  4. Ctrl-C (stop develop)
  5. yarn start

Expected Result

gatsby development server should start

Actual Result

development server fails to start.
here is the error

➜ yarn develop
yarn run v1.22.10
$ gatsby develop
success open and validate gatsby-configs, load plugins - 0.499s
success onPreInit - 0.023s
success initialize cache - 0.005s

 ERROR 

Unable to copy site files to .cache Source and destination must not be the same.



  Error: Source and destination must not be the same.
  
  - stat.js:80 
    [gs]/[fs-extra]/lib/util/stat.js:80:17
  
  - stat.js:38 
    [gs]/[fs-extra]/lib/util/stat.js:38:16
  
  - polyfills.js:299 callback
    [gs]/[graceful-fs]/polyfills.js:299:20
  

not finished copy gatsby files - 0.157s

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

System:
    OS: macOS 11.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.16.1 -
/var/folders/rc/18f_4nld7b96xzxppv88yy6w0000gn/T/yarn--1626187282898-0.11442893238808827/node
    Yarn: 1.22.10 -
/var/folders/rc/18f_4nld7b96xzxppv88yy6w0000gn/T/yarn--1626187282898-0.11442893238808827/yarn
    npm: 6.14.12 - ~/.nvm/versions/node/v14.16.1/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 91.0.4472.114
    Safari: 14.0.3
  npmPackages:
    gatsby: ^3.9.0 => 3.9.0
    gatsby-plugin-gatsby-cloud: ^2.9.0 => 2.9.0
    gatsby-plugin-image: ^1.9.0 => 1.9.0
    gatsby-plugin-manifest: ^3.9.0 => 3.9.0
    gatsby-plugin-offline: ^4.9.0 => 4.9.0
    gatsby-plugin-react-helmet: ^4.9.0 => 4.9.0
    gatsby-plugin-sharp: ^3.9.0 => 3.9.0
    gatsby-source-filesystem: ^3.9.0 => 3.9.0
    gatsby-transformer-sharp: ^3.9.0 => 3.9.0

Config Flags

No response

@sudhyr sudhyr added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 13, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 13, 2021
@LekoArts LekoArts added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 19, 2021
@LekoArts
Copy link
Contributor

LekoArts commented Jul 19, 2021

Hi!

Sorry you're running into an issue. I've tried reproducing but didn't see the issue both on my Windows WSL2 instance and on my Mac. I'm afraid with this state of information we can't do much about it.

You could try debugging the fs-extra code like in serverless-nextjs/serverless-next.js#461

@sudhyr
Copy link
Author

sudhyr commented Jul 25, 2021

The error is coming from fs-extra@8.1.0. Here is what I found.
The file in question is blank.css.
It's being copied from node_modules/gatsby/cache-dir/blank.css to .cache/blank.css

I traced the call stack to this line#438 in gatsby inititalize.ts.

const srcDir = `${__dirname}/../../cache-dir`
const siteDir = cacheDirectory
const tryRequire = `${__dirname}/../utils/test-require-error.js`
try {
await fs.copy(srcDir, siteDir)
await fs.copy(tryRequire, `${siteDir}/test-require-error.js`)

@LekoArts do you think, this could be an issue with fs-extra ?

@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Aug 14, 2021
@github-actions
Copy link

Hey again!

It’s been 60 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to comment on this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

@ZeldOcarina
Copy link

Hi! I'm having this issue too after I moved the project to an external ssd. Basically I can start a dev instance only after a Gatsby clean.. weird..

@ZeldOcarina
Copy link

ZeldOcarina commented Apr 28, 2023

Ok I've fixed it by running gatsby clean and yarn install again on the directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

3 participants