Setting up Your Project on Netlify

Link to chapter - https://serverless-stack.com/chapters/setting-up-your-project-on-netlify.html

What is REACT_APP_STAGE=staging npm run build:netlify

Staging is not an env we setup in the tutorial, should this be something else?

Good catch. I’ll update it. It should be REACT_APP_STAGE=dev npm run build.

1 Like

I would maybe update the page to state that we would need to type that in there too, so it doesn’t get overlooked. It doesn’t default to that text

Sorry which one are you referring to?

I believe @mathewgries was referring to Netlify not auto-populating that “build command” field. When I went through the steps, Netlify just had “npm run build” in that field. Also Netlify has “build/” in the publish directory field, whereas the example in the Guide doesn’t have the forward slash.

I ran into a Deploy Failed error. Here’s the log from Netlify. It says failed to compile and also says I’m missing react stripe elements. Any ideas on where I went wrong?

9:36:36 PM: Build ready to start
9:36:38 PM: build-image version: 9cade8af58c2cf3a17a1e9433d2e979149488837
9:36:38 PM: build-image tag: v3.3.5
9:36:38 PM: buildbot version: 6fd888c8d66fd09bb18f09e1728e11fbc555b868
9:36:38 PM: Fetching cached dependencies
9:36:38 PM: Failed to fetch cache, continuing with build
9:36:38 PM: Starting to prepare the repo for build
9:36:39 PM: No cached dependencies found. Cloning fresh repo
9:36:39 PM: git clone https://github.com/granto/serverless-stack-client
9:36:39 PM: Preparing Git Reference refs/heads/master
9:36:40 PM: Starting build script
9:36:40 PM: Installing dependencies
9:36:41 PM: Downloading and installing node v10.19.0...
9:36:42 PM: Downloading https://nodejs.org/dist/v10.19.0/node-v10.19.0-linux-x64.tar.xz...
9:36:42 PM: 
######################
9:36:42 PM:                 31.9%
9:36:42 PM: 
#########################################
9:36:42 PM: ############################### 100.0%
9:36:42 PM: Computing checksum with sha256sum
9:36:42 PM: Checksums matched!
9:36:45 PM: Now using node v10.19.0 (npm v6.13.4)
9:36:45 PM: Attempting ruby version 2.6.2, read from environment
9:36:46 PM: Using ruby version 2.6.2
9:36:46 PM: Using PHP version 5.6
9:36:46 PM: Started restoring cached node modules
9:36:46 PM: Finished restoring cached node modules
9:36:47 PM: Installing NPM modules using NPM version 6.13.4
9:37:16 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/@babel/runtime-corejs2/node_modules/core-js
9:37:16 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:37:16 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
9:37:16 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
9:37:16 PM: > https://opencollective.com/core-js 
9:37:16 PM: > https://www.patreon.com/zloirock 
9:37:16 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
9:37:16 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
9:37:16 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:37:16 PM: > core-js@3.6.4 postinstall /opt/build/repo/node_modules/core-js
9:37:16 PM: > node -e "try{require('./postinstall')}catch(e){}"
9:37:19 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents):
9:37:19 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:37:19 PM: npm
9:37:19 PM: WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
9:37:19 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:37:19 PM: npm WARN
9:37:19 PM: optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/jest-haste-map/node_modules/fsevents):
9:37:19 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:37:19 PM: npm WARN
9:37:19 PM: optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
9:37:19 PM: npm
9:37:19 PM: WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
9:37:19 PM: added 1628 packages from 863 contributors and audited 919098 packages in 31.443s
9:37:21 PM: 47 packages are looking for funding
9:37:21 PM:   run `npm fund` for details
9:37:21 PM: found 0 vulnerabilities
9:37:21 PM: NPM modules installed
9:37:21 PM: Started restoring cached go cache
9:37:21 PM: Finished restoring cached go cache
9:37:21 PM: unset GOOS;
9:37:21 PM: unset GOARCH;
9:37:21 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
9:37:21 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
9:37:21 PM: go version >&2;
9:37:21 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
9:37:21 PM: go version go1.12 linux/amd64
9:37:21 PM: Installing missing commands
9:37:21 PM: Verify run directory
9:37:21 PM: Executing user command: REACT_APP_STAGE=dev npm run build
9:37:21 PM: > notes-app-client@0.1.0 build /opt/build/repo
9:37:21 PM: > react-scripts build
9:37:23 PM: Creating an optimized production build...
9:37:31 PM: Failed to compile.
9:37:31 PM: ./src/containers/Settings.js
9:37:31 PM: Cannot find module: 'react-stripe-elements'. Make sure this package is installed.
9:37:31 PM: You can install this package by running: npm install react-stripe-elements.
9:37:32 PM: npm
9:37:32 PM:  ERR! code
9:37:32 PM:  ELIFECYCLE
9:37:32 PM: npm
9:37:32 PM: ERR! errno 1
9:37:32 PM: npm
9:37:32 PM:  ERR! notes-app-client@0.1.0 build: `react-scripts build`
9:37:32 PM: npm
9:37:32 PM: ERR!
9:37:32 PM:  Exit status 1
9:37:32 PM: npm
9:37:32 PM: ERR!
9:37:32 PM: npm
9:37:32 PM: ERR!
9:37:32 PM:  Failed at the notes-app-client@0.1.0 build script.
9:37:32 PM: npm
9:37:32 PM: ERR! This is probably not a problem with npm. There is likely additional logging output above.
9:37:32 PM: npm ERR! A complete log of this run can be found in:
9:37:32 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-02-26T05_37_32_084Z-debug.log
9:37:32 PM: Skipping functions preparation step: no functions directory set
9:37:32 PM: Caching artifacts
9:37:32 PM: Started saving node modules
9:37:32 PM: Finished saving node modules
9:37:32 PM: Started saving pip cache
9:37:32 PM: Finished saving pip cache
9:37:32 PM: Started saving emacs cask dependencies
9:37:32 PM: Finished saving emacs cask dependencies
9:37:32 PM: Started saving maven dependencies
9:37:32 PM: Finished saving maven dependencies
9:37:32 PM: Started saving boot dependencies
9:37:32 PM: Finished saving boot dependencies
9:37:32 PM: Started saving go dependencies
9:37:32 PM: Finished saving go dependencies
9:37:35 PM: Error running command: Build script returned non-zero exit code: 1
9:37:35 PM: Failing build: Failed to build site
9:37:35 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:37:35 PM: Finished processing build request in 56.643776464s

@jayair I’m in over my head here and hoping maybe you see something obvious for me to fix?

I got to it work so wanted to leave this tip here for anyone else that has a build fail. I needed to run “npm install react-stripe-elements” in my notes-app-client directory and then push to git.

1 Like

Hi folks,

Just in case it helps anyone else, I was working behind our corporate proxy so I had an .npmrc file in there with our corporate proxy. I checked this in and was getting the following exception.

Maximum call stack size exceeded on npm install

Removing the .npmrc allowed the build to continue.

Thanks,
Mark.

1 Like

For some reason my build is not passing. I believe its because it cannot find the config file. I’m trying to follow the tutorial as closely as possible and I’m wondering if anyone else has ran into this issue.

thanks!

Can you make sure that you’ve checked in the config file into Git?