Build fails code E401

Suddenly all attempts to build any of my sites fail with the same issue as shown in the log attached.
Here’s the log dump

12:55:26 PM: Build ready to start
12:55:38 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
12:55:38 PM: build-image tag: v4.8.0
12:55:38 PM: buildbot version: a0072c9aa857edb8d0052da6c6482646b4348b94
12:55:38 PM: Fetching cached dependencies
12:55:38 PM: Failed to fetch cache, continuing with build
12:55:38 PM: Starting to prepare the repo for build
12:55:38 PM: No cached dependencies found. Cloning fresh repo
12:55:38 PM: git clone https://github.com/MartyNZ/SOL-xxxx
12:55:39 PM: Preparing Git Reference pull/62/head
12:55:40 PM: Parsing package.json dependencies
12:55:41 PM: Starting build script
12:55:41 PM: Installing dependencies
12:55:41 PM: Python version set to 2.7
12:55:42 PM: Downloading and installing node v16.15.0…
12:55:42 PM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz
12:55:43 PM: Computing checksum with sha256sum
12:55:43 PM: Checksums matched!
12:55:46 PM: Now using node v16.15.0 (npm v8.5.5)
12:55:46 PM: Started restoring cached build plugins
12:55:46 PM: Finished restoring cached build plugins
12:55:46 PM: Attempting ruby version 2.7.2, read from environment
12:55:47 PM: Using ruby version 2.7.2
12:55:48 PM: Using PHP version 8.0
12:55:48 PM: No npm workspaces detected
12:55:48 PM: Started restoring cached node modules
12:55:48 PM: Finished restoring cached node modules
12:55:49 PM: Installing NPM modules using NPM version 8.5.5
12:56:01 PM: npm ERR! code E401
12:56:01 PM: npm ERR! Incorrect or missing password.
12:56:01 PM: npm ERR! If you were trying to login, change your password, create an
12:56:01 PM: npm ERR! authentication token or enable two-factor authentication then
12:56:01 PM: npm ERR! that means you likely typed your password in incorrectly.
12:56:01 PM: Creating deploy upload records
12:56:01 PM: npm ERR! Please try again, or recover your password at:
12:56:01 PM: npm ERR! npm | Recover Password
12:56:01 PM: npm ERR!
12:56:01 PM: npm ERR! If you were doing some other operation then your saved credentials are
12:56:01 PM: npm ERR! probably out of date. To correct this please try logging in again with:
12:56:01 PM: npm ERR! npm login
12:56:01 PM: npm ERR! A complete log of this run can be found in:
12:56:02 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
12:56:01 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-05-30T00_55_49_691Z-debug-0.log
12:56:01 PM: Error during NPM install
12:56:01 PM: Build was terminated: Build script returned non-zero exit code: 1
12:56:02 PM: Failing build: Failed to build site
12:56:02 PM: Finished processing build request in 24.304667378s

Please explain what I’ve done wrong and how to fix it.

Hey @MartyNZ

Unfortunately the deploy log is private. Are you able to post the contents of log here inside a code block?

1 Like

Are you using a private repository, or private modules?

Interestingly all but one of the sites are now working again.
The remaining one is a private repository (as they all are).

is this still happening?

Hi,
Yes it is, but the error has changed.
See log dump below.

8:48:52 AM: Build ready to start

8:49:07 AM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)

8:49:07 AM: build-image tag: v4.8.0

8:49:07 AM: buildbot version: 4aaa27647e859c2d38cfbb25901ceae1e7f3eeae

8:49:07 AM: Fetching cached dependencies

8:49:07 AM: Failed to fetch cache, continuing with build

8:49:07 AM: Starting to prepare the repo for build

8:49:07 AM: No cached dependencies found. Cloning fresh repo

8:49:07 AM: git clone https://github.com/MartyNZ/SOL-Standard-Template

8:49:08 AM: Preparing Git Reference refs/heads/master

8:49:08 AM: Parsing package.json dependencies

8:49:09 AM: Starting build script

8:49:09 AM: Installing dependencies

8:49:09 AM: Python version set to 2.7

8:49:10 AM: Downloading and installing node v16.15.1…

8:49:10 AM: Downloading https://nodejs.org/dist/v16.15.1/node-v16.15.1-linux-x64.tar.xz

8:49:11 AM: Computing checksum with sha256sum

8:49:11 AM: Checksums matched!

8:49:13 AM: Now using node v16.15.1 (npm v8.11.0)

8:49:13 AM: Started restoring cached build plugins

8:49:13 AM: Finished restoring cached build plugins

8:49:13 AM: Attempting ruby version 2.7.2, read from environment

8:49:14 AM: Using ruby version 2.7.2

8:49:14 AM: Using PHP version 8.0

8:49:15 AM: No npm workspaces detected

8:49:15 AM: Started restoring cached node modules

8:49:15 AM: Finished restoring cached node modules

8:49:15 AM: Installing NPM modules using NPM version 8.11.0

8:49:15 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

8:49:15 AM: npm WARN config location in the cache, and they are managed by

8:49:15 AM: npm WARN config cacache.

8:49:16 AM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special

8:49:16 AM: npm WARN config location in the cache, and they are managed by

8:49:16 AM: npm WARN config cacache.

8:49:26 AM: npm ERR! code E401

8:49:26 AM: npm ERR! Incorrect or missing password.

8:49:26 AM: npm ERR! If you were trying to login, change your password, create an

8:49:26 AM: npm ERR! authentication token or enable two-factor authentication then

8:49:26 AM: Creating deploy upload records

8:49:26 AM: npm ERR! that means you likely typed your password in incorrectly.

8:49:26 AM: npm ERR! Please try again, or recover your password at:

8:49:26 AM: npm ERR! npm | Recover Password

8:49:26 AM: npm ERR!

8:49:26 AM: npm ERR! If you were doing some other operation then your saved credentials are

8:49:26 AM: npm ERR! probably out of date. To correct this please try logging in again with:

8:49:26 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1 (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)

8:49:26 AM: npm ERR! npm login

8:49:26 AM: npm ERR! A complete log of this run can be found in:

8:49:26 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-06-02T20_49_16_006Z-debug-0.log

8:49:26 AM: Error during NPM install

8:49:26 AM: Build was terminated: Build script returned non-zero exit code: 1

8:49:26 AM: Failing build: Failed to build site

8:49:26 AM: Finished processing build request in 19.404861558s

hi there, this seems related:

can you try and see if their solution works for you?

this is a setting that netlify sets and uses, so how do I change it? I’m running node v14.x.x on my development machine.

I’m still having the same problem with several of my sites. I’ve reverted to manual deploys in order to get my sites published.

hi there @MartyNZ , please see this doc on setting node versions: