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

No longer able to find local plugin after upgrading Gatsby #4274

Closed
ssanchez opened this issue Feb 28, 2018 · 7 comments
Closed

No longer able to find local plugin after upgrading Gatsby #4274

ssanchez opened this issue Feb 28, 2018 · 7 comments
Assignees

Comments

@ssanchez
Copy link
Contributor

Description

After upgrading to Gatsby 1.9.217 and changing no source code, develop and build now fail to find a locally-defined plugin. I've tried two different repos, each with a different local source plugin. The plugin folder is in a plugins folder at the project root and contains a gatsby-node.js and a package.json, the latter with just an empty object as its contents.

Environment

Gatsby version: 1.9.217
Node.js version: 9.2.0
Operating System: MacOS Sierra 10.12.6

File contents (if changed):

No changes.

Actual result

$ gatsby develop
success delete html and css files from previous builds — 0.068 s
success open and validate gatsby-config.js — 0.006 s
error UNHANDLED REJECTION


  Error: Unable to find plugin "gatsby-source-randomuser"

  - load.js:89 resolvePlugin
    [gatsby-source-api-test]/[gatsby]/dist/bootstrap/load-plugins/load.js:89:11

  - load.js:138 processPlugin
    [gatsby-source-api-test]/[gatsby]/dist/bootstrap/load-plugins/load.js:138:27

  - load.js:159
    [gatsby-source-api-test]/[gatsby]/dist/bootstrap/load-plugins/load.js:159:28

  - Array.forEach

  - load.js:158 _callee$
    [gatsby-source-api-test]/[gatsby]/dist/bootstrap/load-plugins/load.js:158:28

  - index.js:61 _callee$
    [gatsby-source-api-test]/[gatsby]/dist/bootstrap/load-plugins/index.js:61:18


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

Expected behavior

The local plugin should be found and used.

Steps to reproduce

1. Create a local plugin as outlined in the documentation

2. Add it to your gatsby-config.js

3. Try to develop or build

@KyleAMathews
Copy link
Contributor

Probably related to @m-allanson's PR #3889

@tsriram
Copy link
Contributor

tsriram commented Feb 28, 2018

@KyleAMathews yep, #4275 should fix this :)

@ghost ghost removed the review label Feb 28, 2018
@KyleAMathews
Copy link
Contributor

Thanks @tsriram! We really need integration tests :-(

@m-allanson
Copy link
Contributor

🤦‍♂️

Thanks @tsriram! I'm looking forwards to when we have integration tests up and running.

@iamricky
Copy link

iamricky commented May 31, 2019

Using "gatsby": "^2.0.105" and I'm definitely still seeing this bug:

  - load.js:107 resolvePlugin
    [gatsby]/dist/bootstrap/load-plugins/load.js:107:11
  
  - load.js:119 processPlugin
    [gatsby]/dist/bootstrap/load-plugins/load.js:119:20
  
  - load.js:169 config.plugins.forEach.plugin
    [gatsby]/dist/bootstrap/load-plugins/load.js:169:20
  
  - Array.forEach
  
  - load.js:168 module.exports
    [gatsby]/dist/bootstrap/load-plugins/load.js:168:20
  
  - index.js:56 
    [gatsby]/dist/bootstrap/load-plugins/index.js:56:21
  
  - Generator.next
  
  - new Promise
  
  - index.js:85 
    [gatsby]/dist/bootstrap/load-plugins/index.js:85:17
  
  - index.js:124 
    [gatsby]/dist/bootstrap/index.js:124:36
  
  - Generator.next

Tried both local plugin walkthroughs:
https://www.gatsbyjs.org/docs/creating-a-local-plugin/
https://github.com/gatsbyjs/gatsby/tree/master/examples/using-local-plugins

@PawanHegde
Copy link

I'd faced a similar issue recently with a local plugin. Code that had been working fine for months started to fail with the following error.

Couldn't find the "<plugin-name>" plugin declared in "<path-to-project>/gatsby-config.js".

Tried looking for a local plugin in <path-to-project>/plugins/<plugin-name>.

Because I hadn't provided a value for main in my package.json file, gatsby was defaulting to index.js, which wasn't present. The solution is to either create an index.js file inside your plugin folder, or add the entry main: "gatsby-node.js" inside package.json

@cmc333333
Copy link

Thank you @PawanHegde ! There's no way I would have figured that out on my own after the error started surfacing when upgrading from 2.16.1 to 2.17.7.

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

No branches or pull requests

7 participants