Search code examples
reactjsdeploymentnetlify

Deployed once to Netlify, then nothing. Any Ideas?


Ive been combing through stackoverflow and netlify forums to find a solution to this, but so far it's a no go. Ive tried adding build: "CI= npm run build" to the package.json file :

"scripts": {
    "start": "craco start",
    "build": "CI= npm run build",
    "test": "craco test",
    "eject": "react-scripts eject"
  },

Ive added it to the netlify build command too for shiggles, to see if it would work. It deployed with the npm run build command before the first upload, but since then nothing. Here is the output for that as well.

Netlify Terminal Output:

2:08:30 PM: Build ready to start
2:08:33 PM: build-image version: c6001ed68662a13e5deb24abec2b46058c58248a
2:08:33 PM: build-image tag: v3.9.0
2:08:33 PM: buildbot version: cf5e043aa2042f885b3ec4c152fb434068ebe66a
2:08:33 PM: Fetching cached dependencies
2:08:33 PM: Starting to download cache of 108.5MB
2:08:33 PM: Finished downloading cache in 631.631199ms
2:08:33 PM: Starting to extract cache
2:08:38 PM: Finished extracting cache in 4.19839743s
2:08:38 PM: Finished fetching cache in 4.852533785s
2:08:38 PM: Starting to prepare the repo for build
2:08:38 PM: Preparing Git Reference refs/heads/main
2:08:40 PM: Parsing package.json dependencies
2:08:40 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus './build' in the Netlify UI
2:08:40 PM: Starting build script
2:08:41 PM: Installing dependencies
2:08:41 PM: Python version set to 2.7
2:08:41 PM: Started restoring cached node version
2:08:44 PM: Finished restoring cached node version
2:08:44 PM: v12.18.0 is already installed.
2:08:45 PM: Now using node v12.18.0 (npm v6.14.4)
2:08:45 PM: Started restoring cached build plugins
2:08:45 PM: Finished restoring cached build plugins
2:08:45 PM: Attempting ruby version 2.7.2, read from environment
2:08:46 PM: Using ruby version 2.7.2
2:08:47 PM: Using PHP version 5.6
2:08:47 PM: Started restoring cached node modules
2:08:47 PM: Finished restoring cached node modules
2:08:47 PM: Installing NPM modules using NPM version 6.14.4
2:09:27 PM: npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
2:09:27 PM: > [email protected] install /opt/build/repo/node_modules/tsparticles
2:09:27 PM: > node ./scripts/install.js
2:09:27 PM: Thank you for installing tsParticles.
2:09:27 PM: Remember to checkout the official website https://particles.js.org to explore some samples.
2:09:27 PM: You can find more samples on CodePen too: https://codepen.io/collection/DPOage
2:09:27 PM: If you need documentation you can find it here: https://particles.js.org
2:09:27 PM: Remember to leave a star on the tsParticles repository if you like the project and want to support it: https://github.com/matteobruni/tsparticles
2:09:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js
2:09:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:09:27 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
2:09:27 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:09:28 PM: > [email protected] postinstall /opt/build/repo/node_modules/react-app-polyfill/node_modules/core-js
2:09:28 PM: > node -e "try{require('./postinstall')}catch(e){}"
2:09:30 PM: npm WARN @testing-library/[email protected] requires a peer of @testing-library/dom@>=7.21.4 but none is installed. You must install peer dependencies yourself.
2:09:30 PM: npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
2:09:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/webpack-dev-server/node_modules/fsevents):
2:09:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:09:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/watchpack-chokidar2/node_modules/fsevents):
2:09:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:09:30 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
2:09:30 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:09:30 PM: added 1141 packages from 205 contributors, removed 368 packages, updated 134 packages and audited 2722 packages in 42.248s
2:09:32 PM: 158 packages are looking for funding
2:09:32 PM:   run `npm fund` for details
2:09:32 PM: found 3 moderate severity vulnerabilities
2:09:32 PM:   run `npm audit fix` to fix them, or `npm audit` for details
2:09:32 PM: NPM modules installed
2:09:32 PM: Started restoring cached go cache
2:09:32 PM: Finished restoring cached go cache
2:09:32 PM: go version go1.14.4 linux/amd64
2:09:32 PM: go version go1.14.4 linux/amd64
2:09:32 PM: Installing missing commands
2:09:32 PM: Verify run directory
2:09:33 PM: ​
2:09:33 PM: ────────────────────────────────────────────────────────────────
2:09:33 PM:   Netlify Build                                                 
2:09:33 PM: ────────────────────────────────────────────────────────────────
2:09:33 PM: ​
2:09:33 PM: ❯ Version
2:09:33 PM:   @netlify/build 18.2.7
2:09:33 PM: ​
2:09:33 PM: ❯ Flags
2:09:33 PM:   baseRelDir: true
2:09:33 PM:   deployId: 6118069e8e7ae10008dd02ff
2:09:33 PM: ​
2:09:33 PM: ❯ Current directory
2:09:33 PM:   /opt/build/repo
2:09:33 PM: ​
2:09:33 PM: ❯ Config file
2:09:33 PM:   No config file was defined: using default values.
2:09:33 PM: ​
2:09:33 PM: ❯ Context
2:09:33 PM:   production
2:09:33 PM: ​
2:09:33 PM: ────────────────────────────────────────────────────────────────
2:09:33 PM:   1. Build command from Netlify app                             
2:09:33 PM: ────────────────────────────────────────────────────────────────
2:09:33 PM: ​
2:09:33 PM: $ CI= npm run build
2:09:33 PM: > [email protected] build /opt/build/repo
2:09:33 PM: > CI= npm run build
2:09:34 PM: > [email protected] build /opt/build/repo
2:09:34 PM: > CI= npm run build
2:09:34 PM: > [email protected] build /opt/build/repo
2:09:34 PM: > CI= npm run build
2:09:34 PM: > [email protected] build /opt/build/repo
2:09:34 PM: > CI= npm run build
2:09:35 PM: > [email protected] build /opt/build/repo
2:09:35 PM: > CI= npm run build
2:09:35 PM: > [email protected] build /opt/build/repo
2:09:35 PM: > CI= npm run build
2:09:35 PM: > [email protected] build /opt/build/repo
2:09:35 PM: > CI= npm run build
2:09:35 PM: > [email protected] build /opt/build/repo

It keeps repeating until I cancel the deploy. Any clues as what I am doing wrong?


Solution

  • The issue is that the following script is an infinite loop:

    "scripts": {
        "build": "CI= npm run build"
    }
    

    npm run build will run the build script, which says to do npm run build, which recurses forever.

    You should replace the build rule with what you actually want to do, for example:

    "scripts": {
        "build": "react-scripts build"
    }