Error in npm while deploying site

Issue with npm in netlify build

Getting the following build error during deployment. Please note that I have another site app-adeptdc.netlify.app (custom domain app.adeptdc.com) built from the same git repo. Right now the builds are stopped for it and some of the environment variables are different. But when builds are activated for app-adeptdc.netlify.app with match environment variables, build succeeds. Also building locally with netlify build works fine.

11:58:37 PM: Build ready to start
11:58:39 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
11:58:39 PM: build-image tag: v3.4.1
11:58:39 PM: buildbot version: 8c957a6d09a03023cea4239847cc73a9cb64eeb7
11:58:39 PM: Fetching cached dependencies
11:58:39 PM: Failed to fetch cache, continuing with build
11:58:39 PM: Starting to prepare the repo for build
11:58:40 PM: No cached dependencies found. Cloning fresh repo
11:58:40 PM: git clone git@gitlab.com:adeptdc/k8s-ui
11:58:41 PM: Preparing Git Reference refs/heads/master
11:58:42 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
11:58:42 PM: Starting build script
11:58:42 PM: Installing dependencies
11:58:42 PM: Python version set to 2.7
11:58:43 PM: Attempting node version '10.16.3' from .nvmrc
11:58:44 PM: Downloading and installing node v10.16.3...
11:58:44 PM: Downloading https://nodejs.org/dist/v10.16.3/node-v10.16.3-linux-x64.tar.xz...
11:58:44 PM: Computing checksum with sha256sum
11:58:44 PM: Checksums matched!
11:58:46 PM: Now using node v10.16.3 (npm v6.9.0)
11:58:47 PM: Started restoring cached build plugins
11:58:47 PM: Finished restoring cached build plugins
11:58:47 PM: Attempting ruby version 2.7.1, read from environment
11:58:48 PM: Using ruby version 2.7.1
11:58:48 PM: Using PHP version 5.6
11:58:48 PM: 5.2 is already installed.
11:58:48 PM: Using Swift version 5.2
11:58:48 PM: Started restoring cached node modules
11:58:48 PM: Finished restoring cached node modules
11:58:49 PM: Found npm version (6.9.0) that doesn't match expected (6.14.7)
Installing npm at version 6.14.7
11:58:56 PM: /opt/buildhome/.nvm/versions/node/v10.16.3/bin/npm -> /opt/buildhome/.nvm/versions/node/v10.16.3/lib/node_modules/npm/bin/npm-cli.js
11:58:56 PM: /opt/buildhome/.nvm/versions/node/v10.16.3/bin/npx -> /opt/buildhome/.nvm/versions/node/v10.16.3/lib/node_modules/npm/bin/npx-cli.js
11:58:57 PM: + npm@6.14.7
11:58:57 PM: added 41 packages from 16 contributors, removed 33 packages and updated 83 packages in 7.351s
11:58:57 PM: NPM installed successfully
11:58:57 PM: Installing NPM modules using NPM version 6.14.7
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/fs-minipass-6143d4c3/LICENSE'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/fs-minipass-6143d4c3/index.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/fs-minipass-6143d4c3/package.json'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/fs-minipass-6143d4c3/README.md'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/graphql-f99b7f20/jsutils/devAssert.js.flow'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/zen-observable-6cab150d/src/Observable.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/react-dom-2b8261c0/cjs/react-dom-server.browser.production.min.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/graphql-f99b7f20/jsutils/didYouMean.js.flow'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-runtime-e4f60482/build/cli/args.d.ts'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/react-scripts-acc172db/scripts/utils/verifyPackageTree.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/graphql-f99b7f20/language/directiveLocation.js.flow'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-cli-2869ca99/build/init/constants.d.ts'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-runtime-e4f60482/build/cli/args.d.ts.map'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/babel-plugin-emotion-6d39f400/src/utils/transform-expression-with-styles.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/graphql-f99b7f20/type/directives.js.flow'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-cli-2869ca99/build/init/constants.d.ts.map'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-runtime-e4f60482/build/cli/args.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/@apollo/client-f95be2f0/apollo-client.cjs.min.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/cacache-d941ed75/lib/util/hash-to-segments.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/core-js-d232e19e/modules/library/_collection.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/react-scripts-acc172db/scripts/utils/verifyTypeScriptSetup.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-cli-2869ca99/build/init/constants.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-runtime-e4f60482/build/cli/index.d.ts'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/yargs-4b52f837/lib/yerror.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/babel-plugin-emotion-6d39f400/src/utils/transpiled-output-utils.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/yaml-4359107c/dist/index.js'
11:59:06 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/jest-cli-2869ca99/build/init/errors.d.ts'

...

11:59:09 PM: npm WARN tar ENOENT: no such file or directory, lstat '/opt/build/repo/node_modules/.staging/pondjs-09e14204/packages/pond/node_modules/ajv/lib'
11:59:09 PM: npm WARN tar ENOENT: no such file or directory, lstat '/opt/build/repo/node_modules/.staging/pondjs-09e14204/packages/pond/node_modules/ajv/lib'
11:59:09 PM: npm WARN tar ENOENT: no such file or directory, lstat '/opt/build/repo/node_modules/.staging/pondjs-09e14204/packages/pond/node_modules/ajv/lib'
11:59:09 PM: npm WARN tar ENOENT: no such file or directory, lstat '/opt/build/repo/node_modules/.staging/pondjs-09e14204/packages/pond/node_modules/ajv/lib'
11:59:09 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/pondjs-09e14204/packages/pond/node_modules/atob/LICENSE.DOCS'
11:59:11 PM: npm WARN tar ENOENT: no such file or directory, open '/opt/build/repo/node_modules/.staging/@material-ui/icons-1dcfa351/utils/createSvgIcon.d.ts'
11:59:14 PM: npm ERR! code E401
11:59:14 PM: npm ERR! Unable to authenticate, need: Basic realm="https://npm.fontawesome.com/"
11:59:14 PM: npm ERR! A complete log of this run can be found in:
11:59:14 PM: npm ERR!     /opt/buildhome/.npm/_logs/2020-09-17T18_29_14_460Z-debug.log
11:59:14 PM: Error during NPM install
11:59:14 PM: Error running command: Build script returned non-zero exit code: 1
11:59:14 PM: Failing build: Failed to build site
11:59:14 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
11:59:14 PM: Finished processing build request in 34.950037572s

hi there, seems like you have a node version conflict of some kind.

Are you trying “clear cache and redeploy” in the UI? if not, i would try that.

Also, are you sure you are not deploying your node_modules folder?

I tried Clear cache and deploy site but still the same error. node_modules directory is not committed to git. So it must be generated by Netlify’s build system. Interestingly as I mentioned, the same git repo is working fine in another Netlify site.

Any suggestion to debug or fix it?

2:57:47 PM: npm ERR! Unable to authenticate, need: Basic realm="https://npm.fontawesome.com/"

Looks like a specific dependency issue :slight_smile:

Thank you very much. That was indeed the problem.

1 Like