gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.28k stars 10.31k forks source link

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

Closed sudhyr closed 3 years ago

sudhyr commented 3 years ago

Preliminary Checks

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

What I have found so far..

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

LekoArts commented 3 years ago

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 https://github.com/serverless-nextjs/serverless-next.js/issues/461

sudhyr commented 3 years ago

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. https://github.com/gatsbyjs/gatsby/blob/b348b7cb830be148af7d5bb9921d8e5bee3d498f/packages/gatsby/src/services/initialize.ts#L434-L439

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

github-actions[bot] commented 3 years ago

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[bot] commented 3 years ago

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 commented 1 year ago

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 commented 1 year ago

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