Support Forums

I cannot deploy next js site to netlify due to npm err

Hello everyone. I need help understanding this error.

When I deploy a site to Netlify I am always getting this error:

3:24:06 AM: Build ready to start
3:24:08 AM: build-image version: 8925038cf853b22d6397cdcb9904ac88b66bb383 (focal)
3:24:08 AM: build-image tag: v4.5.0
3:24:08 AM: buildbot version: c2658b6ce49cb27704ca96893b48327b2f69714e
3:24:08 AM: Fetching cached dependencies
3:24:08 AM: Failed to fetch cache, continuing with build
3:24:08 AM: Starting to prepare the repo for build
3:24:09 AM: No cached dependencies found. Cloning fresh repo
3:24:09 AM: git clone GitHub - Sorumeiji/project-minami-v2: Optimized version of project minami, using next.js
3:24:20 AM: Preparing Git Reference refs/heads/main
3:24:22 AM: Parsing package.json dependencies
3:24:23 AM: Starting build script
3:24:23 AM: Installing dependencies
3:24:23 AM: Python version set to 2.7
3:24:24 AM: v16.13.0 is already installed.
3:24:25 AM: Now using node v16.13.0 (npm v8.1.0)
3:24:25 AM: Started restoring cached build plugins
3:24:25 AM: Finished restoring cached build plugins
3:24:25 AM: Attempting ruby version 2.7.2, read from environment
3:24:26 AM: Using ruby version 2.7.2
3:24:26 AM: Using PHP version 8.0
3:24:26 AM: Started restoring cached node modules
3:24:26 AM: Finished restoring cached node modules
3:24:27 AM: Installing NPM modules using NPM version 8.1.0
3:24:35 AM: npm ERR! code E401
3:24:35 AM: npm ERR! Incorrect or missing password.
3:24:35 AM: npm ERR! If you were trying to login, change your password, create an
3:24:35 AM: npm ERR! authentication token or enable two-factor authentication then
3:24:35 AM: npm ERR! that means you likely typed your password in incorrectly.
3:24:35 AM: npm ERR! Please try again, or recover your password at:
3:24:35 AM: npm ERR! npm | Recover Password
3:24:35 AM: npm ERR!
3:24:35 AM: npm ERR! If you were doing some other operation then your saved credentials are
3:24:35 AM: npm ERR! probably out of date. To correct this please try logging in again with:
3:24:35 AM: npm ERR! npm login
3:24:35 AM: npm ERR! A complete log of this run can be found in:
3:24:35 AM: npm ERR! /opt/buildhome/.npm/_logs/2021-11-25T09_24_35_272Z-debug.log
3:24:35 AM: Error during NPM install
3:24:35 AM: Build was terminated: Build script returned non-zero exit code: 1
3:24:35 AM: Creating deploy upload records
3:24:35 AM: Failing build: Failed to build site
3:24:35 AM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
3:24:35 AM: Finished processing build request in 27.04647115s

Can anyone help me understand what is happening?

Are you using private npm modules or repositories, by any chance?

1 Like

I am not sure. I can check my Package-lock.Json file to see that?

I don’t see anything strange from a glance but I’ll take a better look tomorrow.

Whatever’s happening, it doesn’t seem related to Netlify. I’ve downloaded your repository and I get the same error locally.

I fixed this on my machine by removing package-lock.json and running npm install as described here.

1 Like