Conflicting lock packages? build/assets? error code 1 and 2

I need advice to debug deploy Netlify App

i am getting exit code 1 and 2 errors - I am not sure where to start really… can I use yarn build as my build command? or does it need to be npm ? also, i have both package-lock.json and yarn.lock… would these conflict and cause error? My build error is as follows:

r 1
12:03:27 PM: make: Leaving directory ‘/opt/build/repo/node_modules/node-sass/build’
12:03:27 PM: gyp ERR! build error
12:03:27 PM: gyp ERR! stack Error: make failed with exit code: 2
12:03:27 PM: gyp ERR! stack at ChildProcess.onExit (/opt/build/repo/node_modules/node-gyp/lib/build.js:262:23)
12:03:27 PM: gyp ERR! stack at ChildProcess.emit (node:events:390:28)
12:03:27 PM: gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
12:03:27 PM: gyp ERR! System Linux 4.19.167+
12:03:27 PM: gyp ERR! command “/opt/buildhome/.nvm/versions/node/v16.12.0/bin/node” “/opt/build/repo/node_modules/node-gyp/bin/node-gyp.js” “rebuild” “–verbose” “–libsass_ext=” “–libsass_cflags=” “–libsass_ldflags=” “–libsass_library=”
12:03:27 PM: gyp ERR! cwd /opt/build/repo/node_modules/node-sass
12:03:27 PM: gyp ERR! node -v v16.12.0
12:03:27 PM: gyp ERR! node-gyp -v v3.8.0
12:03:27 PM: gyp ERR! not ok
12:03:27 PM: Build failed with error code: 1
12:03:27 PM: Error during Yarn install
12:03:27 PM: Build was terminated: Build script returned non-zero exit code: 1
12:03:28 PM: Failing build: Failed to build site
12:03:28 PM: Finished processing build request in 3m55.23159136s

i tried using both npm and yarn build so far… however i am trying to run my project through git.
here are my current settings:

Base directory:

Not set

Build command:

yarn build

Publish directory:


Deploy log visibility:

Logs are public



… i have also created a _redirects file but that did not help…

finally, my “builds” folder appears to only contain my images folder… build/assets

why is JUST my assets folder under build?? … SOS and thanks in advance to anyone who to help!

Hi @shayleemeyer

The gyp ERR! issue here is the version of node-sass used for your project is not compatible with the version of node.js used in the build image. As mentioned on the node-sass package npm page, "node-sass": "4.14.1" (from your package.json) is compatible with node v14.x.x.

Updating this package to v6.0+ is one option (may require updating other packages also.) Another option is to downgrade the version of node used by the build image to v14.17.6 using the NODE_VERSION environment variable as outlined in this post.

I built your site locally, and everything (including the _redirects file) is in the build directory.

Hi Coelmay! Thank you so much for your response! so i tried what you had linked… to change the node version in netlify itself and that, or at least that alone, did not work. That being said i put in some commands to update my node version within my project… and it remains “node-sass” : “4.14.1”… so maybe i misunderstood… How do i update to v6.0+?

Also is it okay that" _redirects" is in the build folder? sorry , as you may have concluded, i am a newbie :slight_smile:

also i just noticed i am now getting a new error (i think) as follows: 9:30:37 AM: ────────────────────────────────────────────────────────────────
9:30:37 AM: ​
9:30:37 AM: $ yarn build
9:30:38 AM: yarn run v1.22.10
9:30:38 AM: $ react-scripts build
9:30:39 AM: Creating an optimized production build…
9:31:29 AM:
9:31:29 AM: Treating warnings as errors because process.env.CI = true.
9:31:29 AM: Most CI servers set it automatically.
9:31:29 AM:
9:31:29 AM: Failed to compile.
9:31:29 AM:
9:31:29 AM: src/components/personal/Personal.jsx
9:31:29 AM: Line 73:11: Using target=“_blank” without rel=“noreferrer” (which implies rel=“noopener”) is a security risk in older browsers: see About rel=noopener react/jsx-no-target-blank
9:31:29 AM: src/components/portfolio/Portfolio.jsx
9:31:29 AM: Line 17:7: Expected a ‘break’ statement before ‘default’ no-fallthrough
9:31:29 AM: Line 28:11: Using target=“_blank” without rel=“noreferrer” (which implies rel=“noopener”) is a security risk in older browsers: see About rel=noopener react/jsx-no-target-blank
9:31:29 AM: error Command failed with exit code 1.
9:31:29 AM: info Visit yarn run | Yarn for documentation about this command.
9:31:29 AM: ​
9:31:29 AM: ────────────────────────────────────────────────────────────────
9:31:29 AM: “build.command” failed
9:31:29 AM: ────────────────────────────────────────────────────────────────
9:31:29 AM: ​
9:31:29 AM: Error message
9:31:29 AM: Command failed with exit code 1: yarn build
9:31:29 AM: ​
9:31:29 AM: Error location
9:31:29 AM: In Build command from Netlify app:
9:31:29 AM: yarn build
9:31:29 AM: ​
9:31:29 AM: Resolved config
9:31:29 AM: build:
9:31:29 AM: command: yarn build
9:31:29 AM: commandOrigin: ui
9:31:29 AM: environment:
9:31:29 AM: - NODE_VERSION
9:31:29 AM: publish: /opt/build/repo/build
9:31:29 AM: publishOrigin: ui
9:31:29 AM: Caching artifacts
9:31:29 AM: Started saving node modules
9:31:29 AM: Finished saving node modules

This might help:

You have both a package-lock.json and yarn.lock in your project @shayleemeyer which Yarn will advise you against. As you are using yarn build for your build command, you can remove the package-lock.json. If you then run

yarn add node-sass   # installs latest
  ## OR ##
yarn add node-sass@6.0.0   # installs specific version

this will update the Node Sass version used in your project along with other dependencies.

However, you have moved passed that issue given the build has started, meaning you successfully changed the node version used. :+1: (You may wish to get your site built first, then go about upgrading the packages used, testing locally to ensure everything works. Perhaps even update your local node version as well.)

It is important to remember that files on Netlify are case-sensitive. I don’t believe this is the issue now as it appears all the files (and references) in your repository are case-correct. The clue to the new error is:

This warning (treated as an error because CI=true by default)

refers to this line in src/components/personal/Personal.jsx

<a href={} target="_blank">

What React is expecting to see is

<a href={} target="_blank" rel="noreferrer">

as per the About rel=noopener link in the log message. Same for the link in src/components/portfolio/Portfolio.jsx.

This message

is referring to the following code from src/components/portfolio/Portfolio.jsx

useEffect(() => {
    switch (selected) {
      case "activities":
        break;    // Missing a break statement 
  }, [selected]);

as it is missing the break statement (which I’ve added above.) This ensures “default” does not run after “activities”.

You can ignore all these warns by changing the build command from yarn build to CI='' yarn build, however (especially in the case of the missing break) I believe it better to fix rather than ignore. You’ll end up with better code in the long run.

I’m still a newbie (after I don’t know how many years) as there is something new to learn every day.

1 Like