gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

Babel doesn't support running Gatsby except it root of site so don't support running gatsby develop from anywhere else #207

Closed tleunen closed 8 years ago

tleunen commented 8 years ago

Looks like there's a difference between these 2 commands:

cd docs
gatsby develop

and

gatsby develop docs

The later was giving me this error while testing the starter kit:

Listening at: http://0.0.0.0:8000
webpack built 0bb52249da3c0740f771 in 233ms
Hash: 0bb52249da3c0740f771
Version: webpack 1.12.14
Time: 233ms
    Asset    Size  Chunks       Chunk Names
bundle.js  100 kB       0       main
chunk    {0} bundle.js (main) 73.1 kB [rendered]
    [0] multi main 40 bytes {0} [built] [1 error]
    [1] /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/~/html-entities/lib/html5-entities.js 49 kB {0} [built]
    [2] /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/~/ansi-html/index.js 4.02 kB {0} [built]
    [3] /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/~/html-entities/index.js 231 bytes {0} [built]
    [4] /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/~/html-entities/lib/html4-entities.js 6.57 kB {0} [built]
    [5] /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/~/html-entities/lib/xml-entities.js 2.98 kB {0} [built]
    [6] (webpack)-hot-middleware/client-overlay.js 1.73 kB {0} [built]
    [7] (webpack)-hot-middleware/client.js 4.18 kB {0} [built]
    [8] (webpack)-hot-middleware/process-update.js 3.88 kB {0} [built]
    [9] (webpack)/buildin/module.js 251 bytes {0} [built]
   [10] ./def/~/ansi-regex/index.js 135 bytes {0} [built]
   [11] ./def/~/strip-ansi/index.js 161 bytes {0} [built]

ERROR in /Users/tleunen/.nvm/versions/node/v5.9.0/lib/~/gatsby/dist/utils/web-entry.js
Module build failed: ReferenceError: Unknown plugin "react-transform"
  at PluginManager.subnormaliseString (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-core/lib/transformation/file/plugin-manager.js:147:13)
  at PluginManager.add (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-core/lib/transformation/file/plugin-manager.js:190:40)
  at File.buildTransformers (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-core/lib/transformation/file/index.js:237:21)
  at new File (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-core/lib/transformation/file/index.js:139:10)
  at Pipeline.transform (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-core/lib/transformation/pipeline.js:164:16)
  at transpile (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-loader/index.js:12:22)
  at Object.module.exports (/Users/tleunen/.nvm/versions/node/v5.9.0/lib/node_modules/gatsby/node_modules/babel-loader/index.js:71:12)
 @ multi main
KyleAMathews commented 8 years ago

The third argument lets you specify the root folder for your Gatsby site. By default it uses .

tleunen commented 8 years ago

Ok, so why is there a difference between the 2 commands? In both cases, the gatsby website is inside docs.

KyleAMathews commented 8 years ago

Looks like a Babel error which suggests that we shouldn't support the third command. I'll rename this issue for this.

tleunen commented 8 years ago

So I guess it works only if the parent directory has Babel? That might explains why it works in my project :)

Can we have a check for that and have a proper warning if babel is not found?