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

[Bug] We encountered an error while trying to load your site's gatsby-config #17008

Closed
lbittner-pdftron opened this issue Aug 23, 2019 · 2 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@lbittner-pdftron
Copy link

Hi there!

Since upgrading to Gatsby 2.13 my windows users have been getting the error mentioned in the title. I actually opened an issue about this before here but closed it because I could not reproduce on a fresh repo.

I decided to try this again and managed to find the bug this time. Its coming from test-require-error.js in this code:

const regex = new RegExp(`Error:\\s(\\S+\\s)?[Cc]annot find module\\s.${moduleName.replace(/[-/\\^$*+?.()|[\]{}]/g, `\\$&`)}`);
const firstLine = err.toString().split(`\n`)[0];

The error messaged generated on some windows machines contains two backslashes instead of one, like this:

 Error: Cannot find module 'D:\\PDFTronWebsite\\pdftron-dev-site\\node_modules\\gatsby-plugin-layout\\gatsby-config'

but the regex is only testing for a single backslash, causing a false negative.

I managed to fix it by changing firstLine to this:

const firstLine = err.toString().replace(/\\\\/g, '\\').split(`\n`)[0];

I know its a bit gross but I didn't want to mess with the giant regex above. There is probably a better way to fix this, but just wanted to let you guys know.

Thanks!

@LekoArts LekoArts added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 4, 2019
@gatsbot
Copy link

gatsbot bot commented Sep 25, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 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. You can also add the label "not stale" to keep this issue open!

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! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 25, 2019
@gatsbot
Copy link

gatsbot bot commented Oct 6, 2019

Hey again!

It’s been 30 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 reopen 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!

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. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants