gatsby-starter-docz icon indicating copy to clipboard operation
gatsby-starter-docz copied to clipboard

"Error: Cannot find module 'to-style'" after attempting to "gatsby develop" cloned repo

Open marinoguerieri opened this issue 5 years ago • 5 comments

Hi. I cloned the repo using gatsby new coolest-library https://github.com/pedronauck/gatsby-starter-docz but I can't "gatsby develop" it, it shows an error. I followed instructions 100% so I guess this must be some kind of bug.

Here's the full printout:

$ gatsby develop
Something is already running at port 8000
Would you like to run the app at another port instead? [Y/n] y
Configuring yargs through package.json is deprecated and will be removed in the next major release, please use the JS API instead.
success open and validate gatsby-configs - 4.219 s

 ERROR

Error in "C:\Z\Poslovno\Web Dev\coolest-library\node_modules\gatsby-mdx\gatsby-node.js": Cannot find module 'to-style'



  Error: Cannot find module 'to-style'

  - loader.js:580 Function.Module._resolveFilename
    internal/modules/cjs/loader.js:580:15

  - loader.js:506 Function.Module._load
    internal/modules/cjs/loader.js:506:25

  - loader.js:636 Module.require
    internal/modules/cjs/loader.js:636:17

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

  - babel-plugin-html-attr-to-jsx-attr.js:2 Object.<anonymous>
    [coolest-library]/[gatsby-mdx]/utils/babel-plugin-html-attr-to-jsx-attr.js:2    :23

  - v8-compile-cache.js:178 Module._compile
    [coolest-library]/[v8-compile-cache]/v8-compile-cache.js:178:30

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

  - loader.js:598 Module.load
    internal/modules/cjs/loader.js:598:32

  - loader.js:537 tryModuleLoad
    internal/modules/cjs/loader.js:537:12

  - loader.js:529 Function.Module._load
    internal/modules/cjs/loader.js:529:3

  - loader.js:636 Module.require
    internal/modules/cjs/loader.js:636:17

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

  - gen-mdx.js:9 Object.<anonymous>
    [coolest-library]/[gatsby-mdx]/utils/gen-mdx.js:9:27

  - v8-compile-cache.js:178 Module._compile
    [coolest-library]/[v8-compile-cache]/v8-compile-cache.js:178:30

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

  - loader.js:598 Module.load
    internal/modules/cjs/loader.js:598:32

marinoguerieri avatar Aug 05 '19 15:08 marinoguerieri

I solved it. It was actually very obvious, I just had to manually install the missing package, i.e. npm install to-style

However, to-style was supposed to be installed automatically after cloning the repo and executing npm install, which didn't happen, probably because it wasn't listed in packages.json, so that's something that needs to be looked into.

EDIT: I closed the issue by mistake. The issue is supposed to be closed when the underlying issue is solved, assuming that's not something that is specific to me. Here's the full gatsby info just in case:

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
  Binaries:
    npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    gatsby: ^2.13.34 => 2.13.34 
    gatsby-image: ^2.0.23 => 2.2.6 
    gatsby-plugin-flow: ^1.1.2 => 1.1.2 
    gatsby-plugin-netlify: ^2.1.3 => 2.1.3 
    gatsby-plugin-netlify-cms: ^4.1.6 => 4.1.6 
    gatsby-plugin-purgecss: ^4.0.0 => 4.0.0 
    gatsby-plugin-react-helmet: ^3.0.4 => 3.1.2 
    gatsby-plugin-sass: ^2.0.7 => 2.1.3 
    gatsby-plugin-sharp: ^2.2.9 => 2.2.9 
    gatsby-remark-copy-linked-files: ^2.1.3 => 2.1.3 
    gatsby-remark-images: ^3.1.7 => 3.1.7 
    gatsby-remark-relative-images: ^0.2.1 => 0.2.2 
    gatsby-source-filesystem: ^2.1.6 => 2.1.6 
    gatsby-theme-docz: ^1.2.0 => 1.2.0 
    gatsby-transformer-remark: ^2.6.9 => 2.6.9 
    gatsby-transformer-sharp: ^2.2.4 => 2.2.4 

marinoguerieri avatar Aug 05 '19 16:08 marinoguerieri

Opened the same issue on original Docz repo: https://github.com/pedronauck/docz/issues/1004 Let's keep this one open too to track the problem

AAverin avatar Aug 13 '19 13:08 AAverin

Still getting this, installing manually seemed to work.

siddharthsharma94 avatar Apr 08 '20 02:04 siddharthsharma94

faced the same issue.

atapas avatar Sep 24 '21 03:09 atapas

2022 still getting this and need to install manually

Zara603 avatar Aug 17 '22 04:08 Zara603