Exit Code 1 - How To Fix Particles.js NPM ERR

Site Information:

Netlify site name: spragginsdesigns.netlify.app
Site Custom Domain: www.spragginsdesigns.com

I have changed quite a bit of code in my repo for this site, but unfortunately I cannot figure out what the issue is. I have posted the build deploy information below. If anyone could lead me in the right direction, I would be very grateful. Also, if you need any information aside from this, I will respond as fast as possible.

I had an issue even with npm run build so I tried the CI= npm run build and they both end in errors. I have not tried using yarn yet, but if anyone has had this issue and resolved it or has any ideas I can try, or if there is some bad code somewhere that would be amazing. Below are a bunch of details that are hopefully helpful to this situation as well.

Current repository

github.com/spragginsdesigns/reactportfolio

Your site has HTTPS enabled

Build command
CI= npm run build

Branch deploys

Deploy all branches pushed to the repository

Ubuntu Focal 20.04 (default)

Environment Variables: CI = False

e084c775-042a-435b-9969-3d8dcdfe3282

9:51:02 PM: Build ready to start
9:51:03 PM: build-image version: d7b3dbfb0846505993c9a131894d1858074c90b4 (focal)
9:51:03 PM: build-image tag: v4.10.1
9:51:03 PM: buildbot version: f45292fab0b32cea549baa8489f553abb9d888be
9:51:04 PM: Building without cache
9:51:04 PM: Starting to prepare the repo for build
9:51:04 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
9:51:04 PM: No cached dependencies found. Cloning fresh repo
9:51:04 PM: git clone https://github.com/spragginsdesigns/reactportfolio
9:51:05 PM: Preparing Git Reference refs/heads/Spraggins-Designs
9:51:06 PM: Parsing package.json dependencies
9:51:07 PM: Starting build script
9:51:07 PM: Installing dependencies
9:51:07 PM: Python version set to 2.7
9:51:07 PM: Downloading and installing node v16.17.0...
9:51:07 PM: Downloading https://nodejs.org/dist/v16.17.0/node-v16.17.0-linux-x64.tar.xz...
9:51:08 PM: Computing checksum with sha256sum
9:51:08 PM: Checksums matched!
9:51:10 PM: Now using node v16.17.0 (npm v8.15.0)
9:51:10 PM: Started restoring cached build plugins
9:51:10 PM: Finished restoring cached build plugins
9:51:10 PM: Attempting ruby version 2.7.2, read from environment
9:51:11 PM: Using ruby version 2.7.2
9:51:11 PM: Using PHP version 8.0
9:51:11 PM: No npm workspaces detected
9:51:11 PM: Started restoring cached node modules
9:51:11 PM: Finished restoring cached node modules
9:51:12 PM: Installing NPM modules using NPM version 8.15.0
9:51:12 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
9:51:12 PM: npm WARN config location in the cache, and they are managed by
9:51:12 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
9:51:12 PM: npm WARN config tmp This setting is no longer used.  npm stores temporary files in a special
9:51:12 PM: npm WARN config location in the cache, and they are managed by
9:51:12 PM: npm WARN config     [`cacache`](http://npm.im/cacache).
9:51:13 PM: npm ERR! code ERESOLVE
9:51:13 PM: npm ERR! ERESOLVE could not resolve
9:51:13 PM: npm ERR!
9:51:13 PM: Creating deploy upload records
9:51:13 PM: npm ERR! While resolving: react-particles-js@3.5.3
9:51:13 PM: npm ERR! Found: react@17.0.2
9:51:13 PM: npm ERR! node_modules/react
9:51:13 PM: npm ERR!   react@"^17.0.1" from the root project
9:51:13 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
9:51:13 PM: npm ERR!   peer react@"*" from @testing-library/react@11.2.7
9:51:13 PM: npm ERR!   node_modules/@testing-library/react
9:51:13 PM: npm ERR!     @testing-library/react@"^11.2.2" from the root project
9:51:13 PM: npm ERR!   2 more (react-dom, react-scripts)
9:51:13 PM: npm ERR!
9:51:13 PM: npm ERR! Could not resolve dependency:
9:51:13 PM: npm ERR! peer react@"^16.0.0" from react-particles-js@3.5.3
9:51:13 PM: npm ERR! node_modules/react-particles-js
9:51:13 PM: npm ERR!   react-particles-js@"^3.4.1" from the root project
9:51:13 PM: npm ERR!
9:51:13 PM: npm ERR! Conflicting peer dependency: react@16.14.0
9:51:13 PM: npm ERR! node_modules/react
9:51:13 PM: npm ERR!   peer react@"^16.0.0" from react-particles-js@3.5.3
9:51:13 PM: npm ERR!   node_modules/react-particles-js
9:51:13 PM: npm ERR!     react-particles-js@"^3.4.1" from the root project
9:51:13 PM: npm ERR!
9:51:13 PM: npm ERR! Fix the upstream dependency conflict, or retry
9:51:13 PM: npm ERR! this command with --force, or --legacy-peer-deps
9:51:13 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
9:51:13 PM: npm ERR!
9:51:13 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
9:51:13 PM: npm ERR! A complete log of this run can be found in:
9:51:13 PM: npm ERR!     /opt/buildhome/.npm/_logs/2022-08-29T04_51_12_512Z-debug-0.log
9:51:13 PM: Error during NPM install
9:51:13 PM: Build was terminated: Build script returned non-zero exit code: 1
9:51:13 PM: Failing build: Failed to build site
9:51:13 PM: Finished processing build request in 9.792895116s```

Hey @spragginsdesigns

Looking at the NPM package listing for react-particles-js it is now deprecated in favour of react-tsparticles.

The first suggestion is to switch to this package.

1 Like

How do you switch from that package correctly?

You would remove the deprecated package (npm rm react-particles-js) and add the new package (npm i react-tsparticles). The implementation is possibly different so you may need to re-work some code. Best check the NPM package page which has code samples and links to other demos and CodePen for reference.