Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Can't make it run because of missing dependency and errors #242

Open
jonathangerbaud opened this issue Jan 31, 2022 · 2 comments
Open

Can't make it run because of missing dependency and errors #242

jonathangerbaud opened this issue Jan 31, 2022 · 2 comments

Comments

@jonathangerbaud
Copy link

Hello,

I've been trying to make this theme work for one full day now, but no success. Well, I managed to make it work but the mdx components are making the website crash.

Here's my package.json

{
  "keywords": [],
  "name": "gatsby-theme-apollo-docs-hello-world",
  "description": "",
  "scripts": {
    "start": "gatsby develop",
    "build": "gatsby build"
  },
  "dependencies": {
    "gatsby-theme-apollo-docs": "^6.0.0"
  },
  "devDependencies": {
    "gatsby": "^3.0.0",
    "react": ">=16.9.0",
    "react-dom": ">=16.9.0"
  },
  "peerDependencies": {
    "gatsby": "^3.0.0",
    "react": ">=16.9.0",
    "react-dom": ">=16.9.0"
  }
}

Here's the gatsby-config.js:

const themeOptions = require('gatsby-theme-apollo-docs/theme-options');

module.exports = {
  plugins: [
    {
      resolve: 'gatsby-theme-apollo-docs',
      options: {
        ...themeOptions,
        baseUrl: "https://www.myurl.com",
        root: __dirname,
        siteName: 'Hello world',
        description: "An example of how to set up Apollo's documentation theme",
        contentDir: "content",
        githubRepo: "a/b",
        sidebarCategories: {
          null: ['index'],
          More: [ 'other', 'dummy' ]
        }
      }
    }
  ]
};

And here's the first error:


> start
> gatsby develop

info We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users
and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release.

We greatly appreciate your help testing the change. Please report any feedback good or bad in the umbrella issue. If you do encounter problems, please disable the
flag by setting it to false in your gatsby-config.js like:

flags: {
  THE_FLAG: false
}

The following flags were automatically enabled on your site:
- DEV_SSR · (Umbrella Issue (https://gatsby.dev/dev-ssr-feedback)) · Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and
fix them without needing to do full builds. See umbrella issue for how to update custom webpack config.

There are 4 other flags available that you might be interested in:
- FAST_DEV · Enable all experiments aimed at improving develop server start time.
- PRESERVE_FILE_DOWNLOAD_CACHE · (Umbrella Issue (https://gatsby.dev/cache-clearing-feedback)) · Don't delete the downloaded files cache when changing
gatsby-node.js & gatsby-config.js files.
- PARALLEL_SOURCING · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/parallel-sourcing-feedback)) · Run all source plugins at the same time instead of serially.
 For sites with multiple source plugins, this can speedup sourcing and transforming considerably.
- LMDB_STORE · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/lmdb-feedback)) · Store nodes in a persistent embedded database (vs in-memory). Lowers peak memory
 usage. Requires Node v14.10 or above.

success open and validate gatsby-configs, load plugins - 3.205s
success onPreInit - 0.006s                                                                                                                                          
success initialize cache - 0.131s
success copy gatsby files - 0.192s
success Compiling Gatsby Functions - 0.458s
success onPreBootstrap - 0.488s
success createSchemaCustomization - 0.358s
warn Calling `createTypes` in the `sourceNodes` API is deprecated. Please use: `createSchemaCustomization`.
warn Calling `createTypes` in the `sourceNodes` API is deprecated. Please use: `createSchemaCustomization`.                                                         
success Checking for changed pages - 0.002s                                                                                                                         
success source and transform nodes - 0.424s
success building schema - 1.141s
success createPages - 0.244s
success createPagesStatefully - 0.180s
info Total nodes: 63, SitePage nodes: 6 (use --verbose for breakdown)
success Checking for changed pages - 0.001s                                                                                                                         
success update schema - 0.181s
success write out redirect data - 0.003s                                                                                                                            
success onPostBootstrap - 0.004s                                                                                                                                    
info bootstrap finished - 11.193s
success onPreExtractQueries - 0.001s                                                                                                                                
success extract queries from components - 1.018s
success write out requires - 0.112s
success run static queries - 0.037s - 2/2 53.84/s
success run page queries - 0.141s - 3/3 21.23/s

 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve 'react-use/lib/useKey' in 'C:\Users\jonat\Documents\Coding\Web\Compill\ApolloDefaultInstall\node_modules\gatsby-theme-apollo-docs\src\components'     

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

File: node_modules\gatsby-theme-apollo-docs\src\components\docset-switcher.js:13:0

                                                                                                                                                                    
 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve 'react-use/lib/useWindowSize' in
'C:\Users\jonat\Documents\Coding\Web\Compill\ApolloDefaultInstall\node_modules\gatsby-theme-apollo-docs\src\components'

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

File: node_modules\gatsby-theme-apollo-docs\src\components\docset-switcher.js:14:0

                                                                                                                                                                    
 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve 'react-use/lib/useLocalStorage' in
'C:\Users\jonat\Documents\Coding\Web\Compill\ApolloDefaultInstall\node_modules\gatsby-theme-apollo-docs\src\components'

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

File: node_modules\gatsby-theme-apollo-docs\src\components\page-layout.js:21:0

                                                                                                                                                                    
 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve 'react-use/lib/useKey' in 'C:\Users\jonat\Documents\Coding\Web\Compill\ApolloDefaultInstall\node_modules\gatsby-theme-apollo-docs\src\components'     

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

File: node_modules\gatsby-theme-apollo-docs\src\components\search.js:11:0


 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve 'react-use/lib/useClickAway' in
'C:\Users\jonat\Documents\Coding\Web\Compill\ApolloDefaultInstall\node_modules\gatsby-theme-apollo-docs\src\components'

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

File: node_modules\gatsby-theme-apollo-docs\src\components\select.js:10:0

not finished Building development bundle - 6.289s                                                                                                                   

The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command npm run start" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

Here's another error when I kind of managed to fix the dependencies:

$ gatsby develop
info We're shipping new features! For final testing, we're rolling them out first to a small % of Gatsby users
and your site was automatically chosen as one of them. With your help, we'll then release them to everyone in the next minor release.

We greatly appreciate your help testing the change. Please report any feedback good or bad in the umbrella issue. If you do encounter problems, please disable the  
flag by setting it to false in your gatsby-config.js like:

flags: {
  THE_FLAG: false
}

The following flags were automatically enabled on your site:
- DEV_SSR · (Umbrella Issue (https://gatsby.dev/dev-ssr-feedback)) · Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and   
fix them without needing to do full builds. See umbrella issue for how to update custom webpack config.

There are 4 other flags available that you might be interested in:
- FAST_DEV · Enable all experiments aimed at improving develop server start time.
- PRESERVE_FILE_DOWNLOAD_CACHE · (Umbrella Issue (https://gatsby.dev/cache-clearing-feedback)) · Don't delete the downloaded files cache when changing
gatsby-node.js & gatsby-config.js files.
- PARALLEL_SOURCING · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/parallel-sourcing-feedback)) · Run all source plugins at the same time instead of serially.
 For sites with multiple source plugins, this can speedup sourcing and transforming considerably.
- LMDB_STORE · EXPERIMENTAL · (Umbrella Issue (https://gatsby.dev/lmdb-feedback)) · Store nodes in a persistent embedded database (vs in-memory). Lowers peak memory
 usage. Requires Node v14.10 or above.

success open and validate gatsby-configs, load plugins - 3.687s
success onPreInit - 0.013s
success initialize cache - 0.103s
success copy gatsby files - 0.185s
success Compiling Gatsby Functions - 0.449s
success onPreBootstrap - 0.477s
success createSchemaCustomization - 0.560s
warn Calling `createTypes` in the `sourceNodes` API is deprecated. Please use: `createSchemaCustomization`.
warn Calling `createTypes` in the `sourceNodes` API is deprecated. Please use: `createSchemaCustomization`.                                                         

 ERROR #11321  PLUGIN

"gatsby-plugin-mdx" threw an error while running the onCreateNode lifecycle:

No "exports" main defined in
C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\gatsby-theme-apollo-docs\node_modules\@babel\helper-compilation-targets\package.json



  Error: No "exports" main defined in C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\gatsby-theme-apollo-docs\node_modules\@babel\helper-compilati
  on-targets\package.json

  - errors:371 new NodeError
    node:internal/errors:371:5

  - resolve:440 throwExportsNotFound
    node:internal/modules/esm/resolve:440:9

  - resolve:692 packageExportsResolve
    node:internal/modules/esm/resolve:692:3

  - loader:482 resolveExports
    node:internal/modules/cjs/loader:482:36

  - loader:522 Function.Module._findPath
    node:internal/modules/cjs/loader:522:31

  - loader:919 Function.Module._resolveFilename
    node:internal/modules/cjs/loader:919:27

  - loader:778 Function.Module._load
    node:internal/modules/cjs/loader:778:27

  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19

  - v8-compile-cache.js:159 require
    [starter]/[v8-compile-cache]/v8-compile-cache.js:159:20

  - debug.js:8 Object.<anonymous>
    [starter]/[gatsby-theme-apollo-docs]/[@babel]/preset-env/lib/debug.js:8:33

  - v8-compile-cache.js:192 Module._compile
    [starter]/[v8-compile-cache]/v8-compile-cache.js:192:30

  - loader:1153 Object.Module._extensions..js
    node:internal/modules/cjs/loader:1153:10

  - loader:981 Module.load
    node:internal/modules/cjs/loader:981:32

  - loader:822 Function.Module._load
    node:internal/modules/cjs/loader:822:12

  - loader:1005 Module.require
    node:internal/modules/cjs/loader:1005:19

  - v8-compile-cache.js:159 require
    [starter]/[v8-compile-cache]/v8-compile-cache.js:159:20


success Checking for changed pages - 0.003s                                                                                                                         
success source and transform nodes - 1.363s                                                                                                                         
success building schema - 1.146s
success createPages - 0.220s
success createPagesStatefully - 0.140s
info Total nodes: 63, SitePage nodes: 6 (use --verbose for breakdown)                                                                                               
success Checking for changed pages - 0.002s                                                                                                                         
success update schema - 0.145s
success write out redirect data - 0.003s                                                                                                                            
success onPostBootstrap - 0.004s                                                                                                                                    
info bootstrap finished - 13.251s
success onPreExtractQueries - 0.001s                                                                                                                                
success extract queries from components - 0.948s
success write out requires - 0.086s
success run static queries - 0.024s - 2/2 83.83/s
success run page queries - 0.130s - 3/3 23.11/s
⠀
You can now view gatsby-theme-apollo-docs-hello-world in the browser.                                                                                               
⠀                                                                                                                                                                   
  http://localhost:8000/                                                                                                                                            
⠀                                                                                                                                                                   
View GraphiQL, an in-browser IDE, to explore your site's data and schema                                                                                            
⠀                                                                                                                                                                   
  http://localhost:8000/___graphql                                                                                                                                  
⠀                                                                                                                                                                   
Note that the development build is not optimized.                                                                                                                   
To create a production build, use gatsby build                                                                                                                      
⠀                                                                                                                                                                   
warn 
C:\Users\jonat\Documents\Coding\Web\Compill\starter\src\gatsby-theme-apollo-docs\components\header-button.js
  1:1  warning  Assign arrow function to a variable before exporting as module default  import/no-anonymous-default-export

✖ 1 problem (0 errors, 1 warning)

success Building development bundle - 25.368s                                                                                                                       
success Writing page-data.json files to public directory - 0.173s - 3/6 34.69/s

<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Resolving 'lodash/package.json' in C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib for build dependencies doesn't lead to expected result 'C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\lodash\package.json', but to 'C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\node_modules\lodash\package.json' instead. Resolving dependencies are ignored for this path.
<w>  at unknown 4 lodash/package.json
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\ModuleCache.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\ModuleCache.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\config.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\config.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\module-types.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\module-types.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\configuration.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\configuration.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-loader\lib\injectCaller.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-loader\lib\injectCaller.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-loader\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-loader\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\gatsby\dist\utils\babel-loader.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\gatsby\dist\utils\babel-loader.js
<w>  at resolve commonjs C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\gatsby\dist\utils\babel-loader.js
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Resolving 'lodash/package.json' in C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib for build dependencies doesn't lead to expected result 'C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\lodash\package.json', but to 'C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\node_modules\lodash\package.json' instead. Resolving dependencies are ignored for this path.
<w>  at unknown 4 lodash/package.json
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\ModuleCache.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\ModuleCache.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\config.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\config.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\mapping.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\mapping.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\babel-plugin-lodash\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\module-types.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\module-types.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\plugins.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\plugins.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\files\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\partial.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\partial.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\config\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\transform.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\transform.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\core\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\plugin-transform-react-constant-elements\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@babel\plugin-transform-react-constant-elements\lib\index.js
<w>  at file dependencies C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@svgr\webpack\lib\index.js
<w>  at file C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@svgr\webpack\lib\index.js
<w>  at resolve commonjs C:\Users\jonat\Documents\Coding\Web\Compill\starter\node_modules\@svgr\webpack\lib\index.js
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command yarn run start" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

I'd really love to use this template but this is unusable right now and I already lost too much time for what was supposed to be an easy install and configure template.

I'd really appreciate it if you could fix all of the errors of the default install.
Thank you and have a nice day.

@jgarrow
Copy link
Contributor

jgarrow commented Jan 31, 2022

A few initial ideas/things you can try:

  • Bump your Gatsby version to v3.14.6 or higher
  • Use npm v6 and node v14

@jonathangerbaud
Copy link
Author

I'm already on Gatsby 3.14.6

NPM 8.1.0
Node 16.13.0

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants