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

Local plugin no longer resolvable [v2.17.7] #19150

Closed
esetnik opened this issue Oct 30, 2019 · 7 comments · Fixed by #19470
Closed

Local plugin no longer resolvable [v2.17.7] #19150

esetnik opened this issue Oct 30, 2019 · 7 comments · Fixed by #19470
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation

Comments

@esetnik
Copy link

esetnik commented Oct 30, 2019

Description

After upgrading to gatsby v2.17.7 local plugins no longer work. Reverting to v2.17.6 resolves the issue.

Steps to reproduce

❯ yarn build
yarn run v1.19.1
$ gatsby build

 ERROR #10226  CONFIG

Couldn't find the "gatsby-plugin-capture-query-string" plugin declared in "/Users/user/work/project/landing/gatsby-config.js".

Tried looking for a local plugin in /Users/user/work/project/landing/plugins/gatsby-plugin-capture-query-string.

Tried looking for an installed package in the following paths:
 - /Users/user/work/project/landing/node_modules/gatsby/dist/bootstrap/load-themes/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/project/landing/node_modules/gatsby/dist/bootstrap/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/project/landing/node_modules/gatsby/dist/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/project/landing/node_modules/gatsby/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/project/landing/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/project/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/work/node_modules/gatsby-plugin-capture-query-string
 - /Users/user/node_modules/gatsby-plugin-capture-query-string
 - /Users/node_modules/gatsby-plugin-capture-query-string
 - /node_modules/gatsby-plugin-capture-query-string

not finished open and validate gatsby-configs - 0.057s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
❯ ls -la /Users/user/work/project/landing/plugins/gatsby-plugin-capture-query-string
total 16
drwxr-xr-x  4 user  staff  128 Aug  7 09:26 .
drwxr-xr-x  3 user  staff   96 Aug  7 09:26 ..
-rw-r--r--  1 user  staff  164 Aug  7 09:26 gatsby-browser.js
-rw-r--r--  1 user  staff    3 Oct 30 12:11 package.json

package.json

{}

gatsby-browser.js

import { captureQueryString } from 'capture-query-string';

export const onRouteUpdate = ({ location }, pluginOptions = {}) => {
  captureQueryString(location);
};

Expected result

v2.17.7 is a semver patch and should not exhibit any change in behavior. Local plugins should still work.

Actual result

Local plugins no longer work

Environment

❯ ./node_modules/.bin/gatsby info --clipboard

  System:
    OS: macOS 10.15.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.0 - ~/.nvm/versions/node/v12.13.0/bin/node
    Yarn: 1.19.1 - ~/.nvm/versions/node/v12.13.0/bin/yarn
    npm: 6.12.0 - ~/.nvm/versions/node/v12.13.0/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 78.0.3904.70
    Firefox: 70.0
    Safari: 13.0.3
  npmPackages:
    gatsby: 2.17.7 => 2.17.7
    gatsby-background-image: 0.8.15 => 0.8.15
    gatsby-image: 2.2.30 => 2.2.30
    gatsby-plugin-manifest: 2.2.26 => 2.2.26
    gatsby-plugin-netlify: 2.1.23 => 2.1.23
    gatsby-plugin-react-helmet: 3.1.13 => 3.1.13
    gatsby-plugin-robots-txt: 1.5.0 => 1.5.0
    gatsby-plugin-sharp: 2.2.36 => 2.2.36
    gatsby-plugin-sitemap: 2.2.19 => 2.2.19
    gatsby-plugin-styled-components: 3.1.11 => 3.1.11
    gatsby-source-filesystem: 2.1.35 => 2.1.35
    gatsby-transformer-sharp: 2.3.2 => 2.3.2
@esetnik esetnik changed the title Local plugin no longer resolvable Local plugin no longer resolvable [v2.17.7] Oct 30, 2019
@esetnik
Copy link
Author

esetnik commented Oct 30, 2019

I believe it is caused by #15856

@esetnik
Copy link
Author

esetnik commented Oct 30, 2019

I was able to get the build to proceed after adding an empty index.js // noop file to my plugin as per https://www.gatsbyjs.org/docs/files-gatsby-looks-for-in-a-plugin/. The documentation should be updated to state that this is now required as of [email protected]

@alampros
Copy link
Contributor

@esetnik - great find, thanks for this!

I was able to get the build to proceed after adding an empty index.js // noop file to my plugin as per https://www.gatsbyjs.org/docs/files-gatsby-looks-for-in-a-plugin/. The documentation should be updated to state that this is now required as of [email protected]

It should also be added to https://www.gatsbyjs.org/docs/creating-a-local-plugin/

@LekoArts LekoArts added good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation labels Nov 1, 2019
@LekoArts
Copy link
Contributor

LekoArts commented Nov 1, 2019

It shouldn't say that it is required from 2.17.7 and onwards as it was always required (also by npm itself). The documentation should be updated, yes, but say that the index.js file is also required and link to https://www.gatsbyjs.org/docs/files-gatsby-looks-for-in-a-plugin/ for further details.

We'd highly appreciate a PR for that!

@esetnik
Copy link
Author

esetnik commented Nov 1, 2019

It wasn’t always required in the sense that it was working just fine without having an index.js file before the latest update.

renespeck added a commit to raki-project/raki-website that referenced this issue Nov 5, 2019
@payner35
Copy link

payner35 commented Nov 6, 2019

dropping in the empty index.js worked for me

@sidharthachatterjee
Copy link
Contributor

Fixed by @vladar and published in [email protected]

Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants