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

File docgenInfo.json missing from 'docs/app' #304

Closed
joshuazmiller opened this issue Jun 28, 2016 · 11 comments
Closed

File docgenInfo.json missing from 'docs/app' #304

joshuazmiller opened this issue Jun 28, 2016 · 11 comments

Comments

@joshuazmiller
Copy link
Contributor

I assume this file is generated; however, when running the initial 'npm start' a breaking error occurs where webpack notes that docgenInfo.json is missing. This file is referenced by doc/app/utils/getComponentDocInfo.js import docgenInfo from '../docgenInfo.json'. Perhaps this file aught to be included in the repo perhaps with some default content?

@levithomason
Copy link
Member

Hm. That is odd, it should build this file first. Can you paste your terminal output after running npm start? Wait until the default task is finished and the webpack built ... log shows up please.

In the mean time, you can run npm run build first, then npm start.

@joshuazmiller
Copy link
Contributor Author

This was the original error output the first time I ran the command. I got around the errors by installing both packages and creating a docgenInfo.json file with {} as its contents. After that, those errors disappeared. I just deleted the file and ran 'npm build' and the file was still not created. That's why I'm thinking adding the empty file (with {} in it) to the repo may help future users, or else as you mentioned adding it later through the build process.

"C:\Program Files\nodejs\npm.cmd" start
[email protected] start C:\Users\Joshua\Dropbox\GitHub\stardust
npm run docs
[email protected] docs C:\Users\Joshua\Dropbox\GitHub\stardust
gulp
[00:24:26] Failed to load external module babel-register
[00:24:26] Requiring external module babel-core/register
[00:25:01] Using gulpfile ~\Dropbox\GitHub\stardust\gulpfile.babel.js
[00:25:01] Starting 'default'...
[00:25:01] Starting 'generate-docs-json'...
[00:25:03] Error in plugin 'gulp-react-docgen'
Message:
No suitable component definition found.
File: C:\Users\Joshua\Dropbox\GitHub\stardust\src\elements\List\List.js.
[00:25:03] Finished 'generate-docs-json' after 2.68 s
[00:25:03] Starting 'serve'...
[00:25:03] Starting 'dll'...
[00:25:09] Time: 5378ms
Asset Size Chunks Chunk Names
dll.vendor.f512fba142c8152c8dbc.js 4.42 MB 0 [emitted] vendor
[00:25:09] Finished 'dll' after 5.74 s
[00:25:09] Starting 'serve'...
[00:25:11] Server running at http://localhost:8080
[00:25:11] Finished 'serve' after 2.03 s
[00:25:11] Finished 'serve' after 7.77 s
[00:25:11] Starting 'watch'...
[00:25:11] Finished 'watch' after 9.09 ms
[00:25:11] Finished 'default' after 10 s
webpack built 9283296a0da510fdf652 in 25000ms
Time: 25000ms
Asset Size Chunks Chunk Names
app.9283296a0da510fdf652.js 4.26 MB 0 app
vendor.9283296a0da510fdf652.js 4.33 MB 1 vendor
ERROR in ./docs/app/App.js
Module not found: Error: Cannot resolve module 'history' in C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app
resolve module history in C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app
looking for modules in C:\Users\Joshua\Dropbox\GitHub\stardust
C:\Users\Joshua\Dropbox\GitHub\stardust\history doesn't exist (module as directory)
resolve 'file' history in C:\Users\Joshua\Dropbox\GitHub\stardust
resolve file
C:\Users\Joshua\Dropbox\GitHub\stardust\history doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\history.webpack.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\history.web.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\history.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\history.json doesn't exist
looking for modules in C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history doesn't exist (module as directory)
resolve 'file' history in C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules
resolve file
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.webpack.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.web.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.json doesn't exist
[C:\Users\Joshua\Dropbox\GitHub\stardust\history]
[C:\Users\Joshua\Dropbox\GitHub\stardust\history]
[C:\Users\Joshua\Dropbox\GitHub\stardust\history.webpack.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\history.web.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\history.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\history.json]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.webpack.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.web.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\node_modules\history.json]
@ ./docs/app/App.js 27:15-33
ERROR in ./docs/app/utils/getComponentDocInfo.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../docgenInfo.json in C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\utils
resolve file
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.webpack.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.web.js doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.json doesn't exist
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.js doesn't exist
resolve directory
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json doesn't exist (directory default file)
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json\package.json doesn't exist (directory description file)
[C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json]
[C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.webpack.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.web.js]
[C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.json]
[C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app\docgenInfo.json.js]
@ ./docs/app/utils/getComponentDocInfo.js 15:18-47
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 1.38 MB 0
Process finished with exit code -1 at 00:26:57.
Execution time: 159,474 ms.

@joshuazmiller
Copy link
Contributor Author

My bad regarding 'npm build' not working. I needed to run 'npm run build' of course. Then the file is auto-created.

@levithomason
Copy link
Member

levithomason commented Jun 28, 2016

The docgenInfo.json is built during npm run build, but also during npm start. It should work with just npm start. I only suggested you run a one off build as a potential work around.

I see a couple other issues:

1

[00:24:26] Failed to load external module babel-register

It seems the babel-register module was not found. I added this module after your report of missing deps. You may need to pull the latest changes, then npm install again. Or, just to be safe, delete your node_modules directory then run npm install again. Try that and let me know what happens. This error should not be happening.

You should see babel-register when running npm ls babel-register.

2

[00:25:03] Error in plugin 'gulp-react-docgen'
Message:
No suitable component definition found.
File: C:\Users\Joshua\Dropbox\GitHub\stardust\src\elements\List\List.js.

This strikes me as odd. gulp-react-docgen is used to generated component docs. This is the error you'll see if there is a syntax error in the component file and it cannot parse it, or if the component is written pretty unconventionally. I'm not sure why it is happening. Perhaps once the PR is opened I can take a closer look.

3

ERROR in ./docs/app/App.js
Module not found: Error: Cannot resolve module 'history' in
C:\Users\Joshua\Dropbox\GitHub\stardust\docs\app

This is the same as issue 1 above, I've just added the history module after your bug report on missing deps. As with 1, try pulling the latest changes, then npm install. If that doesn't resolve this error, then try deleting the node_modules dir and then npm install.

You should see history when running npm ls history.

Give it another go

After trying the fixes in 1 and 3, could you then give it another fresh go? Here's the recap:

Reinstall

  1. pull the latest changes from master
  2. delete node_modules
  3. run npm install
  4. run npm ls babel-register to confirm it is installed
  5. run npm ls history to confirm it is installed

Retry with a clean slate

  1. delete docs/app/docgenInfo.json
  2. run npm start

You should not have any errors on this step. After doing this, could you please paste your terminal output as before (waiting for default finished and webpack built ... logs)? Thanks!

@levithomason
Copy link
Member

@joshuazmiller let me the results of this ^ please

@dvdzkwsk
Copy link
Member

dvdzkwsk commented Jun 28, 2016

@levithomason could it be related to:

https://github.com/TechnologyAdvice/stardust/blob/master/docs/app/utils/getComponentDocInfo.js#L11

Where you are explicitly looking for a / in the path (which will be a \ on windows)?

@levithomason
Copy link
Member

Ah, that sounds completely correct to me. At least for the undefined import issue.

@levithomason
Copy link
Member

OK, @joshuazmiller I believe the undefined doc info issue is now fixed. Please pull the latest master and confirm.

@joshuazmiller
Copy link
Contributor Author

Great! Yes, the issues are all resolved now. I did a clean npm install with one error that you can see in the file included, but no fatal errors and the app compiles successfully when I ran npm start. Great work, thanks!
output-of-npm.txt

@dvdzkwsk
Copy link
Member

@levithomason we will probably want to use better-npm-run or our own setup so that we can define environment variables in npm scripts. This is related to at least one of @joshuazmiller's errors. Windows uses set FOO=bar rather than FOO=bar, and this is mainly what better-npm-run takes care of.

@levithomason
Copy link
Member

I've added #313 for this new issue.

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

3 participants