gatsby build ELIFECYCLE error code 1 with no error message

Created on 30 Jun 2019  Â·  7Comments  Â·  Source: gatsbyjs/gatsby

Description

I'm having trouble building my gatsby app and I'm not able to find any error message to help debug the issue.

gatsby develop works fine with no errors reported

npx gatsby develop -> success
yarn develop -> gatsby develop -> success
npm run develop -> gatsby develop -> success

gatsby build works via npx but not yarn or npm even though it appears that all 3 are using the same version of gatsby 🤔

npx gatsby --version and yarn run gatsby --version and the equivalent npm command all report:

Gatsby CLI version: 2.7.6
Gatsby version: 2.11.4

npx gatsby build -> success

yarn build -> gatsby build ->

$ gatsby build
success open and validate gatsby-configs - 0.017 s
success load plugins - 7.228 s
success onPreInit - 0.007 s
success delete html and css files from previous builds - 0.026 s
success initialize cache - 0.008 s
success copy gatsby files - 0.319 s
warn gatsby-plugin-feed was initialized in gatsby-config.js without a feeds option.
This means that the plugin will use the internal RSS feed creation, which may not
match your use case.
This behavior will be removed in the next major release of gatsby-plugin-feed.
success onPreBootstrap - 0.039 s
success source and transform nodes - 0.306 s
success building schema - 0.830 s
success createPages - 0.120 s
success createPagesStatefully - 0.038 s
success onPreExtractQueries - 0.007 s
success update schema - 0.048 s
success extract queries from components - 0.200 s
success write out requires - 0.006 s
success write out redirect data - 0.007 s
success Build manifest and related icons - 0.198 s
success onPostBootstrap - 0.213 s
â €
info bootstrap finished - 24.217 s
â €
success run static queries - 0.037 s — 2/2 61.52 queries/second
success Building production JavaScript and CSS bundles - 29.701 s
success Rewriting compilation hashes - 0.004 s
success run page queries - 0.352 s — 7/7 20.60 queries/second
success Building static HTML for pages - 3.958 s — 7/7 5.86 pages/second

error Command failed with exit code 1.

npm run build -> gatsby develop ->

> gatsby build

success open and validate gatsby-configs - 0.015 s
success load plugins - 3.653 s
success onPreInit - 0.010 s
success delete html and css files from previous builds - 0.031 s
success initialize cache - 0.010 s
success copy gatsby files - 0.258 s
warn gatsby-plugin-feed was initialized in gatsby-config.js without a feeds option.
This means that the plugin will use the internal RSS feed creation, which may not
match your use case.
This behavior will be removed in the next major release of gatsby-plugin-feed.
success onPreBootstrap - 0.040 s
success source and transform nodes - 0.143 s
success building schema - 0.783 s
success createPages - 0.117 s
success createPagesStatefully - 0.037 s
success onPreExtractQueries - 0.007 s
success update schema - 0.051 s
success extract queries from components - 0.147 s
success write out requires - 0.005 s
success write out redirect data - 0.002 s
success Build manifest and related icons - 0.150 s
success onPostBootstrap - 0.163 s
â €
info bootstrap finished - 13.950 s
â €
success run static queries - 0.042 s — 2/2 69.32 queries/second
success Building production JavaScript and CSS bundles - 12.646 s
success run page queries - 0.164 s — 7/7 43.97 queries/second
success Building static HTML for pages - 2.100 s — 7/7 9.31 pages/second

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `gatsby build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.

Steps to reproduce

This is the repo: https://github.com/tripphamm/blog

You could try to pull it down and install/build.

Environment

System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - /usr/local/bin/node
Yarn: 1.16.0 - ~/.yarn/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 75.0.3770.100
Safari: 12.1.1
npmPackages:
gatsby: ^2.3.25 => 2.11.4
gatsby-image: ^2.0.39 => 2.2.3
gatsby-mdx: ^0.6.3 => 0.6.3
gatsby-plugin-feed: ^2.1.1 => 2.3.1
gatsby-plugin-google-analytics: ^2.0.18 => 2.1.1
gatsby-plugin-manifest: ^2.0.29 => 2.2.0
gatsby-plugin-offline: ^2.0.25 => 2.2.0
gatsby-plugin-react-helmet: ^3.0.12 => 3.1.0
gatsby-plugin-sharp: ^2.0.35 => 2.2.1
gatsby-plugin-typography: ^2.2.13 => 2.3.0
gatsby-remark-copy-linked-files: ^2.0.11 => 2.1.0
gatsby-remark-images: ^2.0.6 => 2.0.6
gatsby-remark-prismjs: ^3.2.8 => 3.3.0
gatsby-remark-responsive-iframe: ^2.1.1 => 2.2.1
gatsby-remark-smartypants: ^2.0.9 => 2.1.0
gatsby-source-filesystem: ^2.0.29 => 2.1.1
gatsby-transformer-remark: ^2.3.12 => 2.5.0
gatsby-transformer-sharp: ^2.1.18 => 2.2.0
npmGlobalPackages:
gatsby-cli: 2.4.8

confirmed bug

Most helpful comment

We just published [email protected] to no longer swallow that error

All 7 comments

I am actually receiving the same message with my site

I ran GatsbyJS with node inspect enabled node --inspect-brk --no-lazy node_modules/gatsby/dist/bin/gatsby build it runs fine then gets hung up on Waiting for the debugger to disconnect...

Even the logs are not very helpful:

0 info it worked if it ends with ok
1 verbose cli [ '/Users/jameswlane/.nvm/versions/node/v10.15.3/bin/node',
1 verbose cli   '/Users/jameswlane/.nvm/versions/node/v10.15.3/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /Users/jameswlane/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/jameswlane/Projects/GitHub/jameswlane/customlane.design/node_modules/.bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/opt/sqlite/bin:/usr/local/opt/expat/bin:/Users/jameswlane/.nvm/versions/node/v10.15.3/bin:/Users/jameswlane/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/bin:/sbin:/Users/jameswlane/.composer/vendor/phpcs/scripts:/Users/jameswlane/.plenv/bin:/Users/jameswlane/.rbenv/bin:/Users/jameswlane/.rbenv/shims:/Users/jameswlane/pear/bin:/Users/jameswlane/pear/share/pear/:/usr/bin:/usr/local/bin:/usr/local/heroku/bin:/usr/local/opt/php55/bin:/usr/local/pear/bin:/usr/local/sbin:/usr/sbin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/jameswlane/.pyenv/bin:/Users/jameswlane/.npm-packages/bin:
9 verbose lifecycle [email protected]~build: CWD: /Users/jameswlane/Projects/GitHub/jameswlane/customlane.design
10 silly lifecycle [email protected]~build: Args: [ '-c', 'gatsby build' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `gatsby build`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/jameswlane/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/jameswlane/.nvm/versions/node/v10.15.3/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/jameswlane/Projects/GitHub/jameswlane/customlane.design
16 verbose Darwin 19.0.0
17 verbose argv "/Users/jameswlane/.nvm/versions/node/v10.15.3/bin/node" "/Users/jameswlane/.nvm/versions/node/v10.15.3/bin/npm" "run" "build"
18 verbose node v10.15.3
19 verbose npm  v6.9.2
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: `gatsby build`
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I've got the same going on here.

I was tracking this on #14931, tho. But this one seems to match more given that npx gatsby build works and that the behavior is not necessarily attached to Netlify.

npx gatsby build works only locally; on Netlify it fails too.

Same issue here. gatsby build (using npm works fine) but using yarn fails. As the default gatsby starter has package-lock and yarn-lock in it netlify uses yarn and is failing to build (since Sat). Removing yarn-lock, forcing netlify to use npm did the trick for me.

Seems like we swallow some graphql errors. I've created a fix for this.

GraphQL request:3:9
2 |       {
3 |         allMarkdownRemark(
  |         ^
4 |           limit: 1000,



  Error: Cannot query field "allMarkdownRemark" on type "Query".
  GraphQL request:3:9
  2 |       {
  3 |         allMarkdownRemark(
    |         ^
  4 |           limit: 1000,

  - internals.js:15
    [tripphamm]/[gatsby-plugin-feed]/internals.js:15:13

Thanks for looking in to this and for posting that error message. Since the source of that error was gatsby-plugin-feed, I opted to simply remove the plugin to unblock myself.

Was there some way that I could have produced that error message myself, @wardpeet? Or were you only able to see that after you made a code change to the gatsby source? (Just wondering if there's a verbose debug mode or something that I could have used)

Sadly no, it seems like we swallowed it. No way to make it visible

We just published [email protected] to no longer swallow that error

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andykais picture andykais  Â·  3Comments

brandonmp picture brandonmp  Â·  3Comments

theduke picture theduke  Â·  3Comments

3CordGuy picture 3CordGuy  Â·  3Comments

benstr picture benstr  Â·  3Comments