Docz: Could not create Open in CodeSandbox

Created on 2 Oct 2018  Â·  9Comments  Â·  Source: doczjs/docz

CodeSandbox

I am creating a lib using nwb but when I am running the docz server I have the following error in terminal:

Could not create Open in CodeSandbox { Error: Cannot find module 

'C:\Users\conrado.ramalho\Desktop\nwb-thinking-in-react\App' from

'C:\Users\conrado.ramalho\Desktop\nwb-thinking-in-react\node_modules\codesandboxer-fs\src'

I have this component in my .mdx file:

import { Playground } from 'docz'
import  MyComponent from './App'

# Hello world

Hello, I'm a mdx file!
<Playground>
  <MyComponent />
</Playground>

Environment

  • OS: [Windows 10]
  • Node/npm version: [e.g. Node 10.4.1/npm 6.1.0]
bug medium

Most helpful comment

Hi guys, sorry the too late response, last weeks was very hard to me and I couldn't see anything about docz, but now I available again, I'll check what's happening here :pray:

All 9 comments

I'm running into a similar similar error due to the fact that my components import .less stylesheets:

Could not create Open in CodeSandbox Error: unparseable filetype: .less for file ...

Same here

The bug can be codesandboxer-fs lib
https://github.com/Noviny/codesandboxer/issues/33

Same here:

Could not create Open in CodeSandbox Error: invalid relative path from to ../components/Box

Hi guys, sorry the too late response, last weeks was very hard to me and I couldn't see anything about docz, but now I available again, I'll check what's happening here :pray:

Fixed on the new release v0.12.10 ✅

It's working great Pedro, thank you! Hope you're having a better week.

@evangoer - are you using a react-component using nwb ?

I am also creating a react library using nwb (react-component).

But, i get this error -

yarn run v1.3.2
$ /Users/gagan/github/react-pvds/node_modules/.bin/docz dev

✖ Client
  Compiled with some errors in 6.05s



 ERROR  Failed to compile with 1 errors                                                                                                                               1:45:35 PM

 error  in ./packages/my-package/src/icon/index.js

**Module build failed (from ./node_modules/happypack/loader.js):**
TypeError: Property elements[0] of ArrayExpression expected node to be of a type ["null","Expression","SpreadElement"] but instead got undefined
    at validate (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:148:13)
    at validator (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:97:7)
    at Object.validate (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/definitions/utils.js:172:7)
    at validate (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/validators/validate.js:17:9)
    at builder (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/builders/builder.js:46:27)
    at Object.ArrayExpression (/Users/gagan/github/my-package/node_modules/@babel/core/node_modules/@babel/types/lib/builders/generated/index.js:233:31)
    at buildObjectExpression (/Users/gagan/github/my-packagenode_modules/babel-plugin-react-docgen/lib/index.js:123:14)
    at buildObjectExpression (/Users/gagan/github/my-package/node_modules/babel-plugin-react-docgen/lib/index.js:108:60)
    at /Users/gagan/github/my-package/node_modules/babel-plugin-react-docgen/lib/index.js:81:19
    at Array.forEach (<anonymous>)

 @ ./packages/my-package/src/icon/docs.mdx 17:0-84 76:12-16 77:19-30 78:18-28 79:19-30 80:18-28 87:25-29 89:10-21 95:26-30 97:10-20 103:26-30 105:10-21 111:26-30 113:10-20 131:8-12
 @ ./.docz/app/imports.js
 @ ./node_modules/docz/dist/index.m.js
 @ ./node_modules/docz-theme-default/dist/index.m.js
 @ ./.docz/app/root.jsx
 @ ./.docz/app/index.jsx
 @ multi ./node_modules/@babel/polyfill/lib/index.js ./.docz/app/index.jsx

I see that this error is pointing at babel 6 vs 7; But, i am not using any babel package directly in this project. The only devDependencies i have is nwb and docz

Any pointers ?

Figured there was some problem with the way i was importing some modules; specifically trying to access a flow type which was not exported by module

wonder how can we make the error more informative. @pedronauck

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PlayMa256 picture PlayMa256  Â·  24Comments

robjac picture robjac  Â·  41Comments

tamagokun picture tamagokun  Â·  23Comments

bugzpodder picture bugzpodder  Â·  26Comments

mzedeler picture mzedeler  Â·  31Comments