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

Plugin options error for gatsby-plugin-manifest and gatsby-remark-images #27839

Closed
barbalex opened this issue Nov 4, 2020 · 18 comments
Closed
Labels
topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins topic: remark/mdx Related to Markdown, remark & MDX ecosystem type: bug An issue or pull request relating to a bug in Gatsby

Comments

@barbalex
Copy link

barbalex commented Nov 4, 2020

Description

Two weeks ago I updated my dependencies: FNSKtZH/ae2@1aa2fa0

That is when yarn dev stopped working with this error:

alexa@PCA C:\Users\alexa\ae2
$ yarn dev
yarn run v1.22.5
$ gatsby develop
success open and validate gatsby-configs - 0.075s
error Invalid plugin options for "gatsby-plugin-manifest":

- "scope" is not allowed
error Invalid plugin options for "gatsby-remark-images":

- "wrapperStyle" must be one of [object]
not finished load plugins - 5.593s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I checked gatsby-plugin-manifest and found absolutely no mention of scope not being allowed.
I also checked gatsby-remark-images and found nothing to be wrong with wrapperStyle.

As all had worked fine before the update, I decided to roll it back.

But now I am facing this error:

$ gatsby develop
success open and validate gatsby-configs - 0.071s
success load plugins - 5.936s
success onPreInit - 0.046s
success initialize cache - 0.008s
success copy gatsby files - 0.459s
success onPreBootstrap - 0.064s
success createSchemaCustomization - 0.118s
success Checking for changed pages - 0.004s
success source and transform nodes - 0.470s
success building schema - 0.377s
info Total nodes: 126, SitePage nodes: 6 (use --verbose for breakdown)
success createPages - 0.052s
success Checking for changed pages - 0.002s
success createPagesStatefully - 0.161s
success update schema - 0.018s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.098s
success onPostBootstrap - 0.109s
info bootstrap finished - 16.776s
success onPreExtractQueries - 0.002s
success extract queries from components - 3.344s
success write out requires - 0.079s
success run page queries - 1.160s - 20/20 17.23/s

 ERROR #98124  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in 'C:\Users\alexa\ae2\node_modules\gatsby-react-router-scroll'

If you're trying to use a package make sure that 'react-dom' is installed. If you're trying to use a local file make sure that the path is correct.

File: node_modules\gatsby-react-router-scroll\scroll-container.js

not finished Generating image thumbnails - 13.432s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Today (two weeks later) I tried updating to the newest gatsby libs. Hoping the issue had been solved in the meantime. But that only provokes the first issue again.

What I have tried during two full work days several times:

  • reverting to the dependencies before updating
  • reverting again to the dependencies after updating
  • updating to newer dependencies (tow weeks later i.e. today)
  • deleting yarn.lock, removing node_modules folder, running gatsby clean in all above cases
  • searched the gatsby issues and the www for solutions. Many. None worked so far

So meanwhile I am completely out of options. I have no idea how to get this project running again.

Of course this project has grown over years and it is much too complicated to create a simple reproducible case. So I guess I am stuck for good.

I fear that if no one finds a bug in gatsby that solves this problem, my only way out will be to rebuild this huge project with a different tool, like next.js. Which makes me cry.

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

alexa@PCA C:\Users\alexa\ae2                                                                          
$ yarn gatsby info --clipboard                                                                        
yarn run v1.22.5                                                                                      
$ C:\Users\alexa\ae2\node_modules\.bin\gatsby info --clipboard                                        
                                                                                                      
  System:                                                                                             
    OS: Windows 10 10.0.19041                                                                         
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz                                            
  Binaries:                                                                                           
    Node: 15.0.1 - ~\AppData\Local\Temp\yarn--1604515285930-0.8068366765720616\node.CMD               
    Yarn: 1.22.5 - ~\AppData\Local\Temp\yarn--1604515285930-0.8068366765720616\yarn.CMD               
    npm: 7.0.3 - C:\Program Files\nodejs\npm.CMD                                                      
  Languages:                                                                                          
    Python: 2.7.17                                                                                    
  Browsers:                                                                                           
    Chrome: 86.0.4240.111                                                                             
    Edge: Spartan (44.19041.423.0), Chromium (86.0.622.61)                                            
  npmPackages:                                                                                        
    gatsby: 2.24.80 => 2.24.80                                                                        
    gatsby-cli: 2.12.109 => 2.12.109                                                                  
    gatsby-plugin-create-client-paths: 2.3.13 => 2.3.13                                               
    gatsby-plugin-eslint: 2.0.8 => 2.0.8                                                              
    gatsby-plugin-manifest: 2.4.35 => 2.4.35                                                          
    gatsby-plugin-offline: 3.2.33 => 3.2.33                                                           
    gatsby-plugin-react-helmet: 3.3.14 => 3.3.14                                                      
    gatsby-plugin-sharp: 2.6.42 => 2.6.42                                                             
    gatsby-plugin-styled-components: 3.3.14 => 3.3.14                                                 
    gatsby-plugin-typography: 2.5.13 => 2.5.13                                                        
    gatsby-remark-autolink-headers: 2.3.15 => 2.3.15                                                  
    gatsby-remark-copy-linked-files: 2.3.19 => 2.3.19                                                 
    gatsby-remark-emojis: 0.4.3 => 0.4.3                                                              
    gatsby-remark-external-links: 0.0.4 => 0.0.4                                                      
    gatsby-remark-images: 3.3.35 => 3.3.35                                                            
    gatsby-remark-images-medium-zoom: 1.7.0 => 1.7.0                                                  
    gatsby-source-filesystem: 2.3.35 => 2.3.35                                                        
    gatsby-transformer-remark: 2.8.42 => 2.8.42                                                       
    gatsby-transformer-sharp: 2.5.18 => 2.5.18                                                        
@barbalex barbalex added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 4, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 4, 2020
@barbalex
Copy link
Author

barbalex commented Nov 4, 2020

I just updated another project:
update

and got the same error after running yarn && yarn upgrade && yarn dev:

$ gatsby develop
success open and validate gatsby-configs - 0.046s
error Invalid plugin options for "gatsby-plugin-manifest":

- "scope" is not allowed
error Invalid plugin options for "gatsby-remark-images":

- "wrapperStyle" must be one of [object]
not finished load plugins - 4.836s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@LekoArts LekoArts changed the title yarn dev not working in multiple ways since update Plugin options error for gatsby-plugin-manifest and gatsby-remark-images Nov 6, 2020
@LekoArts LekoArts added topic: remark/mdx Related to Markdown, remark & MDX ecosystem topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 6, 2020
@LekoArts
Copy link
Contributor

LekoArts commented Nov 6, 2020

Hey!

Sorry to hear that you run into problems -- with the merge of #27242 we enforced plugin options and sadly didn't catch all undocumented ones. You see the errors (for still valid options) as they are not in the schema.

To unblock you, you can update all dependencies but revert both plugins in question to their previous versions. You can do so by installing it with:

npm install gatsby-plugin-manifest@2.4.37 gatsby-remark-images@3.3.40

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

@LekoArts thanks for your quick update.

I did:

yarn add gatsby-plugin-manifest@2.4.37 gatsby-remark-images@3.3.40
yarn dev

Then got:

$ gatsby develop
success open and validate gatsby-configs - 0.029s
success load plugins - 5.113s
success onPreInit - 0.031s
success initialize cache - 0.006s
success copy gatsby files - 0.427s
success onPreBootstrap - 0.040s
success createSchemaCustomization - 0.088s
success Checking for changed pages - 0.004s
success source and transform nodes - 0.356s
success building schema - 0.345s
info Total nodes: 126, SitePage nodes: 6 (use --verbose for breakdown)
success createPages - 0.033s
success Checking for changed pages - 0.001s
success createPagesStatefully - 0.143s
success update schema - 0.016s
success write out redirect data - 0.001s
success Build manifest and related icons - 0.090s
success onPostBootstrap - 0.100s
info bootstrap finished - 14.584s
success onPreExtractQueries - 0.003s
success extract queries from components - 3.728s
success write out requires - 0.064s
success run page queries - 0.812s - 20/20 24.63/s

 ERROR #98124  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in 'C:\Users\alexa\ae2\node_modules\gatsby-react-router-scroll'

If you're trying to use a package make sure that 'react-dom' is installed. If you're trying to use a local file make sure that the path is correct.

File: node_modules\gatsby-react-router-scroll\scroll-container.js

not finished Generating image thumbnails - 12.912s
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

So I did (I am on Windows):

del yarn.lock
rd /s node_modules

Which systematically errors because some process seems to block. So repeated after restarting the pc.

then:

yarn && yarn clean && yarn dev

But this still gives me:

ERROR #98124  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in 'C:\Users\alexa\ae2\node_modules\gatsby-react-router-scroll'

So what could be wrong with gatsby-react-router-scroll?

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

I now tried to also run yarn cache clean. But this project seems broken 😢

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

As a last resort I updated all libs to the newest versions.
libs

And uncommented the offending plugin options.
2020-11-06_12h14_40

But yarn dev still fails.

@gillkyle
Copy link
Contributor

gillkyle commented Nov 6, 2020

Hey @barbalex, really sorry for the frustration! There's not much worse than not even being able to get a project running.

As a quick attempt to help you bypass the plugin validation, one option is a flag to just skip it, so I opened a PR to bypass the check with an environment variable set, (you can follow it here: #27839) hopefully that would you get around this?

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

@gillkyle yes, that would do. Thanks a lot!

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

Only: I can't even get this project to run any more if I uncomment the offending options. So it will probably not help either

@barbalex
Copy link
Author

barbalex commented Nov 6, 2020

What I need is a solution to this problem:

ERROR #98124  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in 'C:\Users\alexa\ae2\node_modules\gatsby-react-router-scroll'

@LekoArts
Copy link
Contributor

LekoArts commented Nov 9, 2020

I've reset the React version to v16, reset the plugins to pre-validation versions and I also get that issue.

I see that you forked react-spinners-kit as it has faulty peerDeps. Have you tried removing that package or other packages and see if it's the culprit?

The dependencies/peerDeps of gatsby-react-router-scroll are set correctly. So I doubt that this issue is about any package from us but from other packages and incorrectly set peerDeps.

@mxstbr
Copy link
Contributor

mxstbr commented Nov 9, 2020

Related to your validation errors:

error Invalid plugin options for "gatsby-plugin-manifest":

  • "scope" is not allowed

As far as I can tell, gatsby-plugin-manifest indeed does not have a scope option. It appears nowhere on Google search, nor is it mentioned anywhere in the code. 🤔 Where did you find it/what do you think it does?

error Invalid plugin options for "gatsby-remark-images":

  • "wrapperStyle" must be one of [object]

This is an incorrect validation error, as the wrapperStyle option also supports strings! I've opened #27912 to fix this. Sorry for the troubles!

@barbalex
Copy link
Author

barbalex commented Nov 9, 2020

@mxstbr

Thanks for caring!

Where did you find it/what do you think it does?

https://developer.mozilla.org/en-US/docs/Web/Manifest/scope
also: https://web.dev/add-manifest/#manifest-properties

I've opened #27912 to fix this

Thanks!

@barbalex
Copy link
Author

barbalex commented Nov 9, 2020

@LekoArts

Have you tried removing that package or other packages and see if it's the culprit?

I've tried that package. But will try others too. Thanks for the pointer!

@barbalex
Copy link
Author

barbalex commented Nov 9, 2020

I have tried a few dependencies now, so far with no success.

I did see some warnings when installing and updating that seem a bit suspicious:

  • warning gatsby > babel-plugin-add-module-exports > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
  • warning gatsby > babel-plugin-add-module-exports > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

Guess I will have to downgrade node to ensure there is no problem.

@barbalex
Copy link
Author

barbalex commented Nov 9, 2020

O.k., I finally managed to solve this error:

ERROR #98124  WEBPACK

Generating SSR bundle failed

Can't resolve 'react-dom' in 'C:\Users\alexa\ae2\node_modules\gatsby-react-router-scroll'

I went through all my dependencies. There are many 🙄. And cleaned up. Then I stumbled over a dependency that needed some webpack rules to be altered. While looking at the gatsby-node.js file, I spotted another webpack config entry:

if (stage.startsWith('develop')) {
    actions.setWebpackConfig({
      resolve: {
        alias: {
          'react-dom': '@hot-loader/react-dom',
        },
      },
    })
  }

Luckily I had commented why it had been added: #11934 (comment).
So basically it was to patch hot reloading issues. But I forgot to install @hot-loader/react-dom.

After adding @hot-loader/react-dom to the dev dependencies, yarn dev worked again!

To be honest I have absolutely no idea why the missing of @hot-loader/react-dom had no influence for so long (but for hot reloading always seeming to not quite work as expected) and then suddenly - BAM. Maybe some of the other changes had some influence too.

Thanks @LekoArts for your great pointer!

@LekoArts
Copy link
Contributor

Glad to hear that it's working again!

@barbalex
Copy link
Author

Today I updated to:

{
  "gatsby-plugin-manifest": "2.6.1",
  "gatsby-remark-images": "3.5.1"
}

and scope as well as wrapperStyle are not causing the build to break any more.

Thanks to all involved!

@amarks444
Copy link

ERROR

There was a problem loading plugin "gatsby-plugin-manifest". Perhaps you need to install its package?
Use --verbose to see actual error.
ERROR
Failed to resolve gatsby-plugin-manifest unreachable
Error: unreachable

Solution:
I just updated my node and ran again
npm install gatsby.
This Worked for me..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: plugins-PWA Issues related to PWA: the gatsby-plugin-offline and gatsby-plugin-manifest plugins topic: remark/mdx Related to Markdown, remark & MDX ecosystem type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

5 participants