Build works in local, suddenly stopped working in netlify

As explained in the title, i can build in local environement.
First of all i got the error
“Treating warnings as errors because process.env.CI = true.”
Put CI="" and stopped having that issue.
Tried several solutions explained in the forum, like removing package-lock etc
Nothing works, and i don’t see any breaking change in configuration or code:

Maybe I’m not seeing something? Thank you for your help and ideas,

1:51:19 AM: Build ready to start
1:51:21 AM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
1:51:21 AM: build-image tag: v3.3.7
1:51:21 AM: buildbot version: 134ec431c6a3ff76e87cc4dc34007fe13842272f
1:51:22 AM: Fetching cached dependencies
1:51:22 AM: Starting to download cache of 254.9KB
1:51:22 AM: Finished downloading cache in 72.027999ms
1:51:22 AM: Starting to extract cache
1:51:22 AM: Failed to fetch cache, continuing with build
1:51:22 AM: Starting to prepare the repo for build
1:51:22 AM: No cached dependencies found. Cloning fresh repo
1:51:22 AM: git clone https://github.com/lveillard/curious-connect-backoffice
1:51:23 AM: Preparing Git Reference refs/heads/master
1:51:23 AM: Creating functions prep folder
1:51:23 AM: Starting build script
1:51:23 AM: Installing dependencies
1:51:25 AM: Downloading and installing node v10.20.1...
1:51:25 AM: Downloading https://nodejs.org/dist/v10.20.1/node-v10.20.1-linux-x64.tar.xz...
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM: #
1:51:25 AM:  44.7%
1:51:25 AM: 
######################
1:51:25 AM: ################################################## 100.0%
1:51:25 AM: Computing checksum with sha256sum
1:51:25 AM: Checksums matched!
1:51:28 AM: Now using node v10.20.1 (npm v6.14.4)
1:51:28 AM: Attempting ruby version 2.6.2, read from environment
1:51:30 AM: Using ruby version 2.6.2
1:51:30 AM: Using PHP version 5.6
1:51:30 AM: Started restoring cached node modules
1:51:30 AM: Finished restoring cached node modules
1:51:30 AM: Installing NPM modules using NPM version 6.14.4
1:52:08 AM: > node-sass@4.13.1 install /opt/build/repo/node_modules/node-sass
1:52:08 AM: > node scripts/install.js
1:52:09 AM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/linux-x64-64_binding.node
1:52:09 AM: Download complete
1:52:09 AM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
1:52:09 AM: Caching binary to /opt/buildhome/.npm/node-sass/4.13.1/linux-x64-64_binding.node
1:52:10 AM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
1:52:10 AM: > node -e "try{require('./postinstall')}catch(e){}"
1:52:10 AM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
1:52:10 AM: > node -e "try{require('./postinstall')}catch(e){}"
1:52:10 AM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/react-app-polyfill/node_modules/core-js
1:52:10 AM: > node -e "try{require('./postinstall')}catch(e){}"
1:52:10 AM: > node-sass@4.13.1 postinstall /opt/build/repo/node_modules/node-sass
1:52:10 AM: > node scripts/build.js
1:52:11 AM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
1:52:11 AM: Testing binary
1:52:11 AM: Binary is fine
1:52:11 AM: > react-vertical-timeline-component@2.5.0 postinstall /opt/build/repo/node_modules/react-vertical-timeline-component
1:52:11 AM: > node lib/post_install.js
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: optional
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/webpack-dev-server/node_modules/fsevents):
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: notsup
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: optional
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/watchpack/node_modules/fsevents):
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: notsup
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: optional
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/jest-haste-map/node_modules/fsevents):
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: notsup
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: optional
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/glob-watcher/node_modules/fsevents):
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: notsup
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: optional
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
1:52:14 AM: npm
1:52:14 AM: WARN
1:52:14 AM: notsup
1:52:14 AM:  SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
1:52:14 AM: added 2020 packages from 1233 contributors and audited 938840 packages in 42.343s
1:52:16 AM: 60 packages are looking for funding
1:52:16 AM:   run `npm fund` for details
1:52:16 AM: found 1 high severity vulnerability
1:52:16 AM:   run `npm audit fix` to fix them, or `npm audit` for details
1:52:16 AM: NPM modules installed
1:52:17 AM: Started restoring cached go cache
1:52:17 AM: Finished restoring cached go cache
1:52:17 AM: unset GOOS;
1:52:17 AM: unset GOARCH;
1:52:17 AM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
1:52:17 AM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
1:52:17 AM: go version >&2;
1:52:17 AM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
1:52:17 AM: go version go1.12 linux/amd64
1:52:17 AM: Installing missing commands
1:52:17 AM: Verify run directory
1:52:17 AM: Executing user command: npm run build
1:52:17 AM: > cc-backoffice-react@0.1.0 build /opt/build/repo
1:52:17 AM: > react-scripts build
1:52:19 AM: Creating an optimized production build...
1:53:18 AM: Treating warnings as errors because process.env.CI = true.
1:53:18 AM: Most CI servers set it automatically.
1:53:18 AM: Failed to compile.
1:53:18 AM: ./src/views/TimeLine.js
1:53:18 AM:   Line 14:8:  'API' is defined but never used  no-unused-vars
1:53:18 AM: ./src/layouts/Admin.js
1:53:18 AM:   Line 16:18:  'Placeholder' is defined but never used                                                                                 no-unused-vars
1:53:18 AM:   Line 29:6:   React Hook useEffect has a missing dependency: 'globalActions.login'. Either include it or remove the dependency array  react-hooks/exhaustive-deps
1:53:18 AM:   Line 134:7:  'Admins' is defined but never used                                                                                      no-unused-vars
1:53:18 AM: ./src/app.js
1:53:18 AM:   Line 1:17:  'useEffect' is defined but never used  no-unused-vars
1:53:18 AM:   Line 9:10:  'useGlobal' is defined but never used  no-unused-vars
1:53:18 AM: ./src/index.js
1:53:18 AM:   Line 21:10:  'BrowserRouter' is defined but never used  no-unused-vars
1:53:18 AM:   Line 21:25:  'Route' is defined but never used          no-unused-vars
1:53:18 AM:   Line 21:32:  'Switch' is defined but never used         no-unused-vars
1:53:18 AM:   Line 21:40:  'Redirect' is defined but never used       no-unused-vars
1:53:18 AM: ./src/components/Navbars/Menu.js
1:53:18 AM:   Line 27:8:  'API' is defined but never used  no-unused-vars
1:53:18 AM: ./src/layouts/Login.js
1:53:18 AM:   Line 33:6:    React Hook useEffect has a missing dependency: 'globalActions.login'. Either include it or remove the dependency array      react-hooks/exhaustive-deps
1:53:18 AM:   Line 39:10:   'globalState' is assigned a value but never used                                                                            no-unused-vars
1:53:18 AM:   Line 41:23:   'setMissingData' is assigned a value but never used                                                                         no-unused-vars
1:53:18 AM:   Line 47:6:    React Hook useEffect has a missing dependency: 'history'. Either include it or remove the dependency array                  react-hooks/exhaustive-deps
1:53:18 AM:   Line 100:23:  Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby  jsx-a11y/accessible-emoji
1:53:18 AM:   Line 108:23:  Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby  jsx-a11y/accessible-emoji
1:53:18 AM: ./src/views/examples/Profile.js
1:53:18 AM:   Line 42:23:  'globalActions' is assigned a value but never used  no-unused-vars
1:53:18 AM: ./src/actions/login.js
1:53:18 AM:   Line 6:8:   'React' is defined but never used           no-unused-vars
1:53:18 AM:   Line 6:17:  'useHistory' is defined but never used      no-unused-vars
1:53:18 AM:   Line 6:29:  'browserHistory' is defined but never used  no-unused-vars
1:53:18 AM: npm
1:53:18 AM:  ERR! code
1:53:18 AM:  ELIFECYCLE
1:53:18 AM: npm
1:53:18 AM:  ERR! errno 1
1:53:18 AM: npm
1:53:18 AM:  ERR! cc-backoffice-react@0.1.0 build: `react-scripts build`
1:53:18 AM: npm ERR! Exit status 1
1:53:18 AM: npm ERR!
1:53:18 AM: npm ERR! Failed at the cc-backoffice-react@0.1.0 build script.
1:53:18 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
1:53:18 AM: npm
1:53:18 AM: ERR!
1:53:18 AM:  A complete log of this run can be found in:
1:53:18 AM: npm
1:53:18 AM: ERR!
1:53:18 AM:      /opt/buildhome/.npm/_logs/2020-04-13T23_53_18_653Z-debug.log
1:53:18 AM: Function Dir: /opt/build/repo/functions
1:53:18 AM: TempDir: /tmp/zisi-5e94faf7f46a227df2bf4976
1:53:19 AM: Prepping functions with zip-it-and-ship-it 0.3.1
1:53:19 AM: [ { path: '/tmp/zisi-5e94faf7f46a227df2bf4976/hello.zip',
1:53:19 AM:     runtime: 'js' } ]
1:53:19 AM: Prepping functions complete
1:53:19 AM: Caching artifacts
1:53:19 AM: Started saving node modules
1:53:19 AM: Finished saving node modules
1:53:19 AM: Started saving pip cache
1:53:19 AM: Finished saving pip cache
1:53:19 AM: Started saving emacs cask dependencies
1:53:19 AM: Finished saving emacs cask dependencies
1:53:19 AM: Started saving maven dependencies
1:53:19 AM: Finished saving maven dependencies
1:53:19 AM: Started saving boot dependencies
1:53:19 AM: Finished saving boot dependencies
1:53:19 AM: Started saving go dependencies
1:53:19 AM: Finished saving go dependencies
1:53:24 AM: Error running command: Build script returned non-zero exit code: 1
1:53:24 AM: Failing build: Failed to build site
1:53:24 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
1:53:24 AM: Finished processing build request in 2m3.094324543s

just ub case it helps, this is what happens when i remove the CI="" variable (remember that before i did not have this env variable and everything was working fine :frowning: )

2:16:10 AM: Creating an optimized production build...
2:16:10 AM: 
2:16:10 AM: Treating warnings as errors because process.env.CI = true.
2:16:10 AM: Most CI servers set it automatically.
2:16:10 AM: 
2:16:10 AM: Failed to compile.
2:16:10 AM: npm ERR! code ELIFECYCLE
2:16:10 AM: npm ERR! errno 1
2:16:10 AM: npm ERR! cc-backoffice-react@0.1.0 build: `react-scripts build`
2:16:10 AM: npm ERR! Exit status 1
2:16:10 AM: npm ERR!
2:16:10 AM: npm ERR! Failed at the cc-backoffice-react@0.1.0 build script.
2:16:10 AM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2:16:10 AM: npm ERR! A complete log of this run can be found in:
2:16:10 AM: npm ERR!     /opt/buildhome/.npm/_logs/2020-04-14T00_16_10_001Z-debug.log
2:16:10 AM: ​
2:16:10 AM: ┌─────────────────────────────┐
2:16:10 AM: │        Build failed         │
2:16:10 AM: └─────────────────────────────┘
2:16:10 AM: ​
2:16:10 AM: ❯ Error message
2:16:10 AM:   Command failed with exit code 1: npm run build​
2:16:10 AM: ​
2:16:10 AM: ❯ Error location
2:16:10 AM:   In configuration "build.lifecycle.onBuild" command:
2:16:10 AM:   npm run build
2:16:10 AM: ​
2:16:11 AM: Caching artifacts
2:16:11 AM: Started saving node modules
2:16:11 AM: Finished saving node modules
2:16:11 AM: Started saving pip cache
2:16:11 AM: Finished saving pip cache
2:16:11 AM: Started saving emacs cask dependencies
2:16:11 AM: Finished saving emacs cask dependencies
2:16:11 AM: Started saving maven dependencies
2:16:11 AM: Finished saving maven dependencies
2:16:11 AM: Started saving boot dependencies
2:16:11 AM: Finished saving boot dependencies
2:16:11 AM: Started saving go dependencies
2:16:11 AM: Finished saving go dependencies
2:16:11 AM: Error running command: Build script returned non-zero exit code: 1
2:16:11 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
2:16:11 AM: Failing build: Failed to build site
2:16:11 AM: Finished processing build request in 2m8.925511919s

Also, i tried to clean all warnings and the build is successful… But i don’t want to clean every single warning and before it was just working fine :S

2 Likes

Where did you add CI=""? In the Netlify env vars? Or in the build cmd?

Is a good question and seems to solve my issue haha

How can I add the CI=""in the build cmd in netlify?

Also… i guess that will solve my issue but… do you have an idea what forced without my permission the use of CI? I was 100% able to build with dozens of warnings before and i did not change anything in the configuration…

Having the same issue with react build created with create-react-app. I get this to work after changing the build command from npm install && npm run build to CI=false&&npm install && npm run build. Setting CI to false, the code is able to compile with warnings.

2 Likes

Yep same here. Came up today. So i guess netlify did make an update.

1 Like

Hey! Apologies in advance for the following copy/paste response. If I don’t clear anything up and/or your problem persists, please do reply.

This build may have failed because of the introduction of an unplanned change to builds in the last 24 hours. In your failed deploy log, you may see the line: Treating warnings as errors because process.env.CI = true

Basically, this change would mean that your site won’t deploy if there’s warnings. Although we plan to introduce this in some capacity in the future, like most other CI platforms already have, now wasn’t the time and we’ve rolled this back.

TL;DR: if you re-deploy your site now, it should work! If not, please reply.

2 Likes

Thanks for the update! While understandable why this happened and that it may need to happen in the future, a heads up and guide on how to fix this would be greatly appreciated next time.

Keep up the great work!

Hello there!
I thougth I managed to deploy but it was actually because of no warnings. I keep having this issue when there are warnings :S

You’ll only be exhibiting this particular issue if you have CI=1. Can you share an affected deploy log?

Hello! Thank you for the help :slight_smile:

Sent you the deploy link, please ping me if it is not public, but it should be

Well, you’re not wrong!

12:26:07 AM: Treating warnings as errors because process.env.CI = true.
12:26:07 AM: Most CI servers set it automatically.

I can see that there’s an environment variable for CI on your UI. It’s also in the build command, too, though it is false here. I’d remove it from both locations and build again :+1:

Yep it was the one on my UI the one that was messing with the deployment. The one in the build command was good and solving the root problem we had, but now that everything is fixed from your side and my variables clean, no need to use it.

Thank you very much! Issue fixed. Btw, I speak about netlify (good things) at each chance I have :slight_smile: you’re doing an awesome job!

Just a quick question: You have access to the variables on my UI because you were checking the issue, or my API keys are actually public for anyone when i share the build link?

1 Like

Thanks for the kind words; we appreciate it!

And don’t worry – I was checking the issue. When you shared the log, only the log itself is public :smile:

1 Like

Hello!
FYI: For some reason the bug came back again and I had to add:
CI=false&&npm install && npm run build
to the build commands

Hey! So, this will be associated with a change to our platform from our end. You can read more here: New CI=true build configuration, "Treating warnings as errors because process.env.CI = true" - #6 by drewclem