fabien0102 / gatsby-starter

Gatsby 2.0 starter with typescript and many cools dev tools
386 stars 99 forks source link

npm run build throws error : Generating JavaScript bundles failed #69

Open sibamohanty995 opened 6 years ago

sibamohanty995 commented 6 years ago

Have tried all the workarounds. Nothing seems to be working.

If i update my node version to 9.10.1, my sharp compatibility goes for a toss as they haven't come up with a sharp package which is compatible with node version 9.10.1.

gatsby-starter@1.0.0 build C:\Users\I339665\Documents\CC\gatsby-starter > gatsby build success delete html and css files from previous builds — 0.039 s success open and validate gatsby-config — 0.007 s info One or more of your plugins have changed since the last time you ran Gatsby. As a precaution, we're deleting your site's cache to ensure there's not any stale data success copy gatsby files — 0.073 s success onPreBootstrap — 1.949 s success source and transform nodes — 0.224 s success building schema — 0.357 s success createLayouts — 0.022 s success createPages — 0.058 s success createPagesStatefully — 0.040 s success onPreExtractQueries — 0.002 s success update schema — 0.162 s success extract queries from components — 0.487 s success run graphql queries — 0.560 s success write out page data — 0.015 s success write out redirect data — 0.004 s success onPostBootstrap — 0.003 s info bootstrap finished - 7.283 s ⠐ Building CSSts-loader: Using typescript@2.8.3 and C:\Users\I339665\Documents\CC\gatsby-starter\tsconfig.json success Building CSS — 29.443 s ⢀ Building production JavaScript bundlests-loader: Using typescript@2.8.3 and C:\Users\I339665\Documents\CC\gatsby-starter\tsconfig.json error Generating JavaScript bundles failed Error: C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\@types\lodash\index.d.ts (10186,53): error TS2344: Type 'T' does not satisfy the constraint 'object'. Error: ./~/gatsby-module-loader?name=component---src-templates-blog-post-tsx!./src/templates/blog-post.tsx (10,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/gatsby-module-loader?name=component---src-templates-blog-post-tsx!./src/templates/blog-post.tsx (17,61): error TS7006: Parameter 'tag' implicitly has an 'any' type. Error: ./~/gatsby-module-loader?name=component---src-templates-blog-post-tsx!./src/templates/blog-post.tsx (20,56): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /templates/blog-post.tsx (10,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /templates/blog-post.tsx (17,61): error TS7006: Parameter 'tag' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /templates/blog-post.tsx (20,56): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./~/gatsby-module-loader?name=component---src-pages-index-tsx!./src/pages/index.tsx (9,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /pages/index.tsx (9,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/gatsby-module-loader?name=component---src-pages-blog-tsx!./src/pages/blog.tsx (11,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/gatsby-module-loader?name=component---src-pages-blog-tsx!./src/pages/blog.tsx (18,92): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /pages/blog.tsx (11,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./~/babel-loader/lib?{"plugins":["C://Users//I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//ba bel-plugin-extract-graphql.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-add-module-exports/ /lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-plugin-transform-object-assign//lib//inde x.js"],"presets":[["C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-env//lib//index.js",{"loose":tr ue,"uglify":true,"modules":"commonjs","targets":{"browsers":["> 1%","last 2 versions","IE >= 9"]},"exclude":["transfor m-regenerator","transform-es2015-typeof-symbol"]}],"C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset -stage-0//lib//index.js","C://Users//I339665//Documents//CC//gatsby-starter//~//babel-preset-react//lib//index.js"],"c acheDirectory":true}!./~/ts-loader?{"compilerOptions":{"target":"esnext","experimentalDecorators":true,"jsx":"react"," module":"commonjs"},"transpileOnly":true}!./~/babel-loader/lib?{"presets":["babel-preset-env"],"plugins":["C://Users// I339665//Documents//CC//gatsby-starter//~//gatsby//dist//utils//babel-plugin-extract-graphql.js"]}!./~/ts-loader!./src /pages/blog.tsx (18,92): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (3,60): error TS7006: Parameter 'target' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (3,68): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (3,368): error TS7006: Parameter 'Constructor' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (3,381): error TS7006: Parameter 'protoProps' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (3,393): error TS7006: Parameter 'staticProps' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (5,26): error TS7006: Parameter 'instance' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (5,36): error TS7006: Parameter 'Constructor' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (7,37): error TS7006: Parameter 'self' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (7,43): error TS7006: Parameter 'call' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (9,20): error TS7006: Parameter 'subClass' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (9,30): error TS7006: Parameter 'superClass' implicitly has an 'any' type. Error: ./src/layouts/index.tsx (28,14): error TS7023: 'DefaultLayout' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. Error: ./src/layouts/index.tsx (31,64): error TS2339: Property 'proto' does not exist on type '() => any'. m Error: ./src/layouts/index.tsx (34,5): error TS2554: Expected 3 arguments, but got 2. Error: ./src/components/TagsCard/TagsCard.tsx (6,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./src/components/TagsCard/TagsCard.tsx (7,330): error TS7006: Parameter 'tag' implicitly has an 'any' type. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\TagsCard\TagsCard.test.tsx (4,22): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/TagsCard/TagsCard.tsx' is not a module. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\TagsCard\TagsCard.stories.tsx (8,22): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/TagsCard/TagsCard.tsx' is not a module. Error: ./src/components/SidebarMenu/SidebarMenu.tsx (7,33): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./src/components/SidebarMenu/SidebarMenu.tsx (13,38): error TS7006: Parameter 'item' implicitly has an 'any' type. Error: ./src/components/SidebarMenu/SidebarMenu.tsx (16,43): error TS7006: Parameter 'item' implicitly has an 'any' type. Error: ./src/components/SidebarMenu/SidebarMenu.tsx (19,240): error TS7006: Parameter 'item' implicitly has an 'any' type. Error: ./src/components/SidebarMenu/SidebarMenu.tsx (24,48): error TS7006: Parameter 'state' implicitly has an 'any' type. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\SidebarMenu\SidebarMenu.test.tsx (4,29): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/SidebarMenu/SidebarMenu.tsx' is not a module. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\SidebarMenu\SidebarMenu.stories.tsx (9,29): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/SidebarMenu/SidebarMenu.tsx' is not a module. Error: ./src/components/HeaderMenu/HeaderMenu.tsx (8,32): error TS7006: Parameter '_ref' implicitly has an 'any' type. Error: ./src/components/HeaderMenu/HeaderMenu.tsx (16,196): error TS7006: Parameter 'item' implicitly has an 'any' type. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\HeaderMenu\HeaderMenu.test.tsx (4,28): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/HeaderMenu/HeaderMenu.tsx' is not a module. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\HeaderMenu\HeaderMenu.stories.tsx (9,28): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/HeaderMenu/HeaderMenu.tsx' is not a module. Error: ./src/components/BlogPagination/BlogPagination.tsx (7,29): error TS7006: Parameter 'props' implicitly has an 'any' type. Error: ./src/components/BlogPagination/BlogPagination.tsx (12,123): error TS7006: Parameter 'index' implicitly has an 'any' type. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\BlogPagination\BlogPagination.test.tsx (4,28): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/BlogPagination/BlogPagination.tsx' is not a module. Error: C:\Users\I339665\Documents\CC\gatsby-starter\src\components\BlogPagination\BlogPagination.stories.tsx (9,28): error TS2306: File 'C:/Users/I339665/Documents/CC/gatsby-starter/src/compon ents/BlogPagination/BlogPagination.tsx' is not a module. Error: ./src/store.ts (12,29): error TS7006: Parameter 'state' implicitly has an 'any' type. Error: ./src/store.ts (12,36): error TS7006: Parameter 'action' implicitly has an 'any' type. Error: ./src/css/semantic.min.css Module build failed: Error: Loader C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\url\url.js?{"limit":10000 ,"name":"static/[name].[hash:8].[ext]"} didn't return a function at NormalModule.loadPitch (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\node_modules\webpack- core\lib\NormalModuleMixin.js:215:20) at NormalModule.doBuild (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\node_modules\webpack-co re\lib\NormalModuleMixin.js:241:4) at NormalModule.build (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\NormalModule.js:84:14 ) at Compilation.buildModule (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\Compilation.js:1 26:9) at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\Compilation.js:309:10 at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\NormalModuleFactory.js:58:13 at NormalModuleFactory.applyPluginsAsyncWaterfall (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\tapab le\lib\Tapable.js:75:69) at onDoneResolving (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\NormalModuleFactory.js:3 8:11) at onDoneResolving (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\NormalModuleFactory.js:1 21:6) at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\webpack\lib\NormalModuleFactory.js:116:7 at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:726:13 at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:52:16 at done (C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:246:17) at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:44:16 at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:723:17 at C:\Users\I339665\Documents\CC\gatsby-starter\node_modules\async\lib\async.js:167:37 @ ./src/layouts/index.tsx 39:0-34 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! gatsby-starter@1.0.0 build: gatsby build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the gatsby-starter@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\I339665\AppData\Roaming\npm-cache_logs\2018-06-25T11_05_31_043Z-debug.log

fabien0102 commented 6 years ago

Gatsby 2.0 beta is live, I need to update all this starter. For now we have some weird compilation fails and I don't really know why… sometime is working sometime not, and it's really hard to debug (because of course, on my computer, it's working).

Really sorry for this bunch of errors, I really need to re-work a bit on this project, but I also have a lot to do aside… Time is always the issue ^^

Regarding you logs, it's somewhere in Typescript, you can begin by allow implicit any 😉

mcku commented 5 years ago

@fabien0102 Personally I like semantic-ui & react & typescript and using Gatsby 2, i have gone through the upgrade procedure here, at a heavily personalized fork. I did not have time to remove the personalization from the blog, sorry. But even that should help you quickly update the starter.

However,with Gatsby 2 there are some issues with image processing. I am not so familiar with Gatsby therefore could not figure out what causes the issues with graphql image processing. ImageSharp responsiveResolution appears not to be available anymore, correct? Any suggestions in that regard?

Thanks in advance!

mcku commented 5 years ago

I have later discovered that there was a "next" branch for the upgrade. :+1: build is fine with that branch. There was only one thing i had to fix:

in blogs.tsx const avatar: ImageSharp = frontmatter.author.avatar.children && frontmatter.author.avatar.children[0] as ImageSharp || frontmatter.author.avatar.childImageSharp as ImageSharp;

instead of const avatar = frontmatter.author.avatar.children[0] as ImageSharp;

because sometimes avatars are childImageSharp

Now it builds fine and works very well with gatsby 2.