Netlify using my global .npmrc private repo instead the local file

Hello guys, I’m facing a different issue here. Looking for an answer usually people got the opposite problem having issue to set their own private registry inside build.

So here’s the thing, my problem look like to be the opposite, netlify is building with my .npmrc globals config inside my computer, but I have pushed inside the repo one .npmrc file.

my .npmrc file inside the repo
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
My netify.toml
[build]

  command = "npm install && npm run build"

  functions = "functions"

# Deploy Preview context:

# All deploys generated from a pull/merge request

# will inherit these settings.

[context.deploy-preview.environment]

  CLIENT_ACCESS_TOKEN="xxxxxxxxxxxxxx"

  DEV_ACCESS_TOKEN="yyyyyyyyyyyyyyyyyyy"

my desktop public .npmrc file

//ped.axur.com/npm/repository/npm-group/:_authToken=NpmToken.3481cd6c-3fa4-3523-9657-bc6dc2aaa1d8

always-auth=true

registry=https://registry.npmjs.com/

//ped.axur.com/npm/repository/npm-internal/:_authToken=NpmToken.3481cd6c-3fa4-3523-9657-bc6dc2aaa1d8

always-auth=true

And here’s the log error inside build:

11:48:09 AM: Build ready to start
11:48:11 AM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
11:48:11 AM: build-image tag: v3.3.7
11:48:11 AM: buildbot version: 134ec431c6a3ff76e87cc4dc34007fe13842272f
11:48:11 AM: Fetching cached dependencies
11:48:12 AM: Starting to download cache of 48.2KB
11:48:12 AM: Finished downloading cache in 178.340565ms
11:48:12 AM: Starting to extract cache
11:48:12 AM: Finished extracting cache in 12.962267ms
11:48:12 AM: Finished fetching cache in 192.430189ms
11:48:12 AM: Starting to prepare the repo for build
11:48:12 AM: Preparing Git Reference pull/3/head
11:48:12 AM: Found Netlify configuration file netlify.toml in site root
11:48:12 AM: Found Netlify configuration file(s). Overriding site configuration
11:48:12 AM: Different build command detected, going to use the one specified in the Netlify configuration file: 'npm install && npm run build' versus '' in the Netlify UI
11:48:12 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus '' in the Netlify UI
11:48:12 AM: Creating functions prep folder
11:48:12 AM: Starting build script
11:48:13 AM: Installing dependencies
11:48:14 AM: Downloading and installing node v10.20.1...
11:48:14 AM: Downloading https://nodejs.org/dist/v10.20.1/node-v10.20.1-linux-x64.tar.xz...
11:48:14 AM: 
##########################################
11:48:14 AM:                             59.1%
11:48:15 AM: 
#####################################
11:48:15 AM: ################################### 100.0%
11:48:15 AM: Computing checksum with sha256sum
11:48:15 AM: Checksums matched!
11:48:17 AM: Now using node v10.20.1 (npm v6.14.4)
11:48:17 AM: Attempting ruby version 2.6.2, read from environment
11:48:19 AM: Using ruby version 2.6.2
11:48:19 AM: Using PHP version 5.6
11:48:19 AM: Started restoring cached node modules
11:48:19 AM: Finished restoring cached node modules
11:48:19 AM: Started restoring cached yarn cache
11:48:19 AM: Finished restoring cached yarn cache
11:48:19 AM: Installing yarn at version 1.17.0
11:48:19 AM: Installing Yarn!
11:48:19 AM: > Downloading tarball...
11:48:19 AM: [1/2]: https://yarnpkg
11:48:19 AM: .com/downloads/1.17.0/yarn-v1.17.0.tar.gz --> /tmp/yarn.tar.gz.LiCovIcr0W
11:48:19 AM:   % Total    % Re
11:48:19 AM: ceived % Xferd  Average Speed   Time    Time     Time
11:48:19 AM:  Current
11:48:19 AM:                          Dl
11:48:19 AM: oad  Upload
11:48:19 AM: Total   Spent    Left  Speed
11:48:19 AM: 
  0     0
11:48:19 AM:     0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
11:48:19 AM: 
  0     0    0     0    0     0
11:48:19 AM:  0      0 --:--:-- --:--:-- --:--:--     0
11:48:19 AM: 
100    80  100    80    0     0
11:48:19 AM: 224      0 --:--:-- --:--:-- --:--:--   224
11:48:20 AM: 
100    93  100    93    0     0
11:48:20 AM:  137      0 --:--:-- --:--:-- --:--:--   137
11:48:20 AM: 
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100   630  100   630    0     0    586      0  0:00:01  0:00:01 --:--:--  615k
11:48:20 AM: 
100 1213k  100 1213k    0     0   812k
11:48:20 AM:     0  0:00:01  0:00:01 --:--:--  812k
11:48:20 AM: [2/2]: https://yarnpkg.com/downloads/1.17.0/yarn-v1.17.0.tar.gz.asc --> /tmp/yarn.tar.gz.LiCovIcr0W.asc
11:48:21 AM: 
100    84  100    84    0     0
11:48:21 AM:  3044      0 --:--:-- --:--:-- --:--:--  3044
11:48:21 AM: 
100    97  100    97    0     0   1755
11:48:21 AM:      0 --:--:-- --:--:-- --:--:--  1755
11:48:21 AM: 1
11:48:21 AM: 0
11:48:21 AM: 0
11:48:21 AM: 6
11:48:21 AM: 3
11:48:21 AM: 4
11:48:21 AM: 1
11:48:21 AM: 0
11:48:21 AM: 0
11:48:21 AM: 6
11:48:21 AM: 3
11:48:21 AM: 4
11:48:21 AM: 0
11:48:21 AM: 0
11:48:21 AM: 3
11:48:21 AM: 0
11:48:21 AM: 1
11:48:21 AM: 5
11:48:21 AM: 0
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: :
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: :
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: :
11:48:21 AM: -
11:48:21 AM: -
11:48:21 AM: :
11:48:21 AM: -
11:48:21 AM: - --:
11:48:21 AM: --:--  3015
11:48:21 AM: 
100   832  100   83
11:48:21 AM: 2    0     0   3243      0 --:--:-- --:--:-- --:-
11:48:21 AM: -:--  3243
11:48:21 AM: > Verifying integrity...
11:48:21 AM: gpg: Signature made Fri 14 Jun 2019 06:55:58 PM UTC using RSA key ID 69475BAA
11:48:21 AM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>"
11:48:21 AM: gpg: WARNING: This key is not certified with a trusted signature!
11:48:21 AM: gpg:          There is no indication that the signature belongs to the owner.
11:48:21 AM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907
11:48:21 AM:   BBB7 1646 B01B 86E5 0310
11:48:21 AM:      Subkey fingerprint: 6D98 490C 6F1A CDDD 448E  4595 4F77 6793 6947 5BAA
11:48:21 AM: > GPG signature looks good
11:48:21 AM: > Extracting to ~/.yarn...
11:48:21 AM: > Adding to $PATH...
11:48:21 AM: > Successfully installed Yarn 1.17.0! Please open another terminal where the `yarn` command will now be available.
11:48:22 AM: Installing NPM modules using Yarn version 1.17.0
11:48:23 AM: yarn install v1.17.0
11:48:23 AM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
11:48:23 AM: [1/4] Resolving packages...
11:48:23 AM: [2/4] Fetching packages...
11:48:23 AM: error An unexpected error occurred: "https://ped.axur.com/npm/repository/npm-group/bytes/-/bytes-3.1.0.tgz: Request failed \"401 Unauthorized\"".
11:48:23 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:48:23 AM: info If you think this is a bug, please open a bug report with the information provided in "/opt/build/repo/yarn-error.log".
11:48:23 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
11:48:23 AM: Error during Yarn install
11:48:23 AM: Error running command: Build script returned non-zero exit code: 1
11:48:24 AM: Shutting down logging, 2 messages pending

Solved deleting my yarn.lock file, my default .npmrc was downloading a few deps from my private repo.

1 Like