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

Error: EISDIR: illegal operation on a directory, read #3860

Closed
DaveLindberg opened this issue Feb 5, 2018 · 3 comments · Fixed by #3861
Closed

Error: EISDIR: illegal operation on a directory, read #3860

DaveLindberg opened this issue Feb 5, 2018 · 3 comments · Fixed by #3861
Assignees

Comments

@DaveLindberg
Copy link

Description

Within my Gatby project I'm using components from another project. They're placed with my src dir, which looks something like this:

src
--assets
--components
  --Header
  --another-project
    --...
    --node_modules
    --...

This was working well for some time in development, but then I started receiving Error: EISDIR: illegal operation on a directory, read during build.

The error is thrown when Gatsby comes across a directory in another-project's node_modules which ends in '.js'; node wants the element to be a file and throws the error because its a DIR. Meanwhile, similarly named directories in Gatsby's node_modules are read properly.

Environment

Gatsby version: 1.1.28
Node.js version: v9.3.0
Operating System: macOS High Sierra 10.13.3

File contents (if changed):

gatsby-config.js:
package.json:
gatsby-node.js:
gatsby-browser.js:
gatsby-ssr.js:

Actual result

What happened.

Expected behavior

What should happen?

Steps to reproduce

1.

2.

3.

...

@Jaikant
Copy link
Contributor

Jaikant commented Feb 5, 2018

Probably similarly named files don't throw the error as the local node modules is not a directory configured in the gatsby-config.js for the source filesystem plugin. So these files aren't seen by the plugin. Possibly?

@DaveLindberg
Copy link
Author

FWIW, here's my current gatsby-config.js:

module.exports = {
  siteMetadata: {
    title: 'My Gatsby Site'
  },
  mapping: {
    'MarkdownRemark.frontmatter.author': 'AuthorsYaml'
  },
  plugins: [
    // Adding various source folders to the GraphQL layer.
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `pages`,
        path: `${__dirname}/src/pages/`
      }
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `data`,
        path: `${__dirname}/src/data/`
      }
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/assets/images/`
      }
    },
    {
      resolve: `gatsby-plugin-google-analytics`,
      options: {
        trackingId: ``
      }
    },
    {
      resolve: `gatsby-plugin-typography`,
      options: {
        pathToConfigModule: `src/utils/typography.js`
      }
    },
    'gatsby-plugin-offline',
    'gatsby-plugin-react-next',
    'gatsby-plugin-sharp',
    'gatsby-transformer-json',
    'gatsby-transformer-remark',
    'gatsby-transformer-sharp',
    'gatsby-transformer-yaml',
    'gatsby-plugin-styled-components'
  ]
};

@pieh
Copy link
Contributor

pieh commented Feb 5, 2018

It's because we try to extract graphql queries from .js (and .jsx and .ts) files in src directory, but we actually get both files and directories - proposed fix in #3861 change that to ignore directories

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.

3 participants