Deploy to Netlify failing
See original GitHub issueDescription
Was wondering if anyone has this issue? Cannot deploy Gatsby blog on netlify as of recently. Gatsby build and develop works perfectly fine on local.
Steps to reproduce
Build and deploy on netlify. Repo: https://github.com/seanngpack/Seans-Portfolio
How to Make a Minimal Reproduction: https://www.gatsbyjs.org/contributing/how-to-make-a-reproducible-test-case/
Expected result
Netlify error seems to be related to Gatsby-cli. Here is a snippet of the build log from Netlify. This is the only error logged and it starts when Netlify calls gatsby build
Executing user command: gatsby build
11:52:38 AM: /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/init-starter.js:117
11:52:38 AM: } catch {
11:52:38 AM: ^
11:52:38 AM: SyntaxError: Unexpected token {
11:52:38 AM: at createScript (vm.js:80:10)
11:52:38 AM: at Object.runInThisContext (vm.js:139:10)
11:52:38 AM: at Module._compile (module.js:617:28)
11:52:38 AM: at Object.Module._extensions..js (module.js:664:10)
11:52:38 AM: at Module.load (module.js:566:32)
11:52:38 AM: at tryModuleLoad (module.js:506:12)
11:52:38 AM: at Function.Module._load (module.js:498:3)
11:52:38 AM: at Module.require (module.js:597:17)
11:52:38 AM: at require (internal/module.js:11:18)
11:52:38 AM: at Object.<anonymous> (/opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli/lib/create-cli.js:28:20)
11:52:38 AM: Skipping functions preparation step: no functions directory set
Environment
click to expand
System: OS: macOS 10.15.4 CPU: (12) x64 Intel® Core™ i7-9750H CPU @ 2.60GHz Shell: 5.7.1 - /bin/zsh Binaries: Node: 14.3.0 - /usr/local/bin/node npm: 6.14.5 - /usr/local/bin/npm Languages: Python: 3.7.7 - /usr/local/opt/python/libexec/bin/python Browsers: Chrome: 81.0.4044.138 Safari: 13.1 npmPackages: gatsby: ^2.22.9 => 2.22.9 gatsby-image: ^2.2.33 => 2.4.5 gatsby-plugin-feed: ^2.3.21 => 2.5.3 gatsby-plugin-google-analytics: ^2.1.28 => 2.3.2 gatsby-plugin-manifest: ^2.2.29 => 2.4.9 gatsby-plugin-react-helmet: ^3.1.15 => 3.3.2 gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0 gatsby-plugin-sharp: ^2.3.2 => 2.6.9 gatsby-plugin-typography: ^2.3.17 => 2.5.2 gatsby-remark-copy-linked-files: ^2.1.30 => 2.3.3 gatsby-remark-embed-video: ^2.0.1 => 2.0.1 gatsby-remark-images: ^3.1.33 => 3.3.8 gatsby-remark-prismjs: ^3.3.24 => 3.5.2 gatsby-remark-responsive-iframe: ^2.2.27 => 2.4.3 gatsby-remark-smartypants: ^2.1.16 => 2.3.2 gatsby-source-filesystem: ^2.1.38 => 2.3.8 gatsby-transformer-remark: ^2.6.37 => 2.8.13 gatsby-transformer-sharp: ^2.3.5 => 2.5.3 npmGlobalPackages: gatsby-cli: 2.12.34
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (2 by maintainers)
Top GitHub Comments
Thank you this worked for me! For me it was as simple as setting an environment variable in Netlify like so:
NODE_VERSION 10
Hey @seanngpack, I was running into the exact same issue and I ended up fixing it by setting a higher Node.js version in Netlify. My Netlify build was defaulting to v8.17.0 when Gatsby needs v10.13.0 or higher.
I committed a
.nvmrc
file with the version matching what I was using locally and everything built and deployed fine. There are some other ways to set the Node version documented here.Hope this helps!