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:

Thanks,
I’ve looked into this. I’ve also updated all packages within the project to their latest version and tested the site in a dev environment. When tested locally there are no issues.

I redeployed the updated site this morning and this is the error I got.
12:37:36 PM: Build ready to start
12:37:38 PM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
12:37:38 PM: build-image tag: focal
12:37:38 PM: buildbot version: 7b804ef49dc9bfd8ae6e08b25d297f8eb94d3bc5
12:37:38 PM: Fetching cached dependencies
12:37:38 PM: Failed to fetch cache, continuing with build
12:37:38 PM: Starting to prepare the repo for build
12:37:38 PM: No cached dependencies found. Cloning fresh repo
12:37:38 PM: git clone https://github.com/MartyNZ/SOL-Standard-template
12:37:39 PM: Preparing Git Reference refs/heads/master
12:37:39 PM: Parsing package.json dependencies
12:37:41 PM: Starting build script
12:37:41 PM: Installing dependencies
12:37:41 PM: Python version set to 2.7
12:37:41 PM: Downloading and installing node v16.16.0…
12:37:42 PM: Downloading https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz
12:37:42 PM: Computing checksum with sha256sum
12:37:42 PM: Checksums matched!
12:37:45 PM: Now using node v16.16.0 (npm v8.11.0)
12:37:45 PM: Started restoring cached build plugins
12:37:45 PM: Finished restoring cached build plugins
12:37:45 PM: Attempting ruby version 2.7.2, read from environment
12:37:46 PM: Using ruby version 2.7.2
12:37:47 PM: Using PHP version 8.0
12:37:47 PM: No npm workspaces detected
12:37:47 PM: Started restoring cached node modules
12:37:47 PM: Finished restoring cached node modules
12:37:48 PM: Installing NPM modules using NPM version 8.11.0
12:37:48 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:37:48 PM: npm WARN config location in the cache, and they are managed by
12:37:48 PM: npm WARN config cacache.
12:37:48 PM: npm WARN config tmp This setting is no longer used. npm stores temporary files in a special
12:37:48 PM: npm WARN config location in the cache, and they are managed by
12:37:48 PM: npm WARN config cacache.
12:37:54 PM: npm WARN deprecated stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: Array.prototype.sort() - JavaScript | MDN
12:38:03 PM: npm ERR! code E401
12:38:03 PM: npm ERR! Incorrect or missing password.
12:38:03 PM: npm ERR! If you were trying to login, change your password, create an
12:38:03 PM: npm ERR! authentication token or enable two-factor authentication then
12:38:03 PM: Creating deploy upload records
12:38:03 PM: npm ERR! that means you likely typed your password in incorrectly.
12:38:03 PM: npm ERR! Please try again, or recover your password at:
12:38:03 PM: npm ERR! npm | Recover Password
12:38:03 PM: npm ERR!
12:38:03 PM: npm ERR! If you were doing some other operation then your saved credentials are
12:38:03 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
12:38:03 PM: npm ERR! probably out of date. To correct this please try logging in again with:
12:38:03 PM: npm ERR! npm login
12:38:03 PM: npm ERR! A complete log of this run can be found in:
12:38:03 PM: npm ERR! /opt/buildhome/.npm/_logs/2022-07-15T00_37_48_796Z-debug-0.log
12:38:03 PM: Error during NPM install
12:38:03 PM: Build was terminated: Build script returned non-zero exit code: 1
12:38:03 PM: Failing build: Failed to build site
12:38:03 PM: Finished processing build request in 25.154478467s

The error seems to be around credentials?! “Incorrect or missing password”…
Missing from where?

TIA
Martyn

I’m assuming you’re using private npm modules. Have you checked this: [Support Guide] Using private NPM modules on Netlify?

Hi,
Thanks for your response. But, no. I am not using private npm modules.

Hey @MartyNZ thanks for confirming. Since the error you’re seeing is happening before the build command can run, there is unfortunately not much we can see on our side as of now.

If you enable verbose logging for NPM in the Environment Variables for your site, however, that should help because it will give a bit more information on the error and where it’s happening.

You can get there by going to your site → click “Deploy settings” → “Environment” → “Edit variables”. The variable name is NPM_FLAGS and the value is --verbose.

Once you’ve done that, let us know what happens and we can work from there.

Hi @amelia,
Thanks for the tip. I was able to trace the issue to a fontawesome package in my package.json. Removing that and linking to a fontawesome kit has solved the issue.

Cheers
Martyn

1 Like