Bad Artifactory URL Causing build failers

Posted on March 5, 2025 by Michael Keane Galloway

At work we use a system called Artifactory. This system helps us have a unified repository for all of our build artifacts. That way we can story NPM packages, NuGet Packages, and Docker container images (as well as other build artifacts) in one convenient place. Unfortunately, in September of 2023 there was a malformed Artifactory URL that led to a local build error on my system. I couldn’t find anyone else experiencing this while I was trying to fix it, so I thought I’d write it up (yes, this sat on my to do list for quite a while).

I had the following rather long error spit out at me for every Node application or library I was trying to build:

Arguments: 
  C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\yarn\bin\yarn.js build-client

PATH: 
  REDACTED it was the complete PATH variable for my system at work

Yarn version: 
  1.22.19

Node version: 
  18.14.0

Platform: 
  win32 x64

Trace: 
  TypeError: Cannot create property '-artifacts-company-information-' on string '{"-artifacts-company-information-":""}'
      at set (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:53951:28)
      at set (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:53965:14)
      at set (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:53945:16)
      at objectPath.set (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:53998:14)
      at NpmRegistry.mergeEnv (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:92160:18)
      at NpmRegistry.<anonymous> (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:31950:12)
      at Generator.next (<anonymous>)
      at step (C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:310:30)
      at C:\Users\malbertson\AppData\Roaming\nvm\v18.14.0\node_modules\yarn\lib\cli.js:328:14
      at new Promise (<anonymous>)

The fundamental issue seemed to be that the kebab cased string "-artifacts-company-information-" was not a valid property name for an object that was being parsed during the build. I couldn’t find documentation where a string like this was being used for artifactory configuration during local builds.

While digging around, I eventually found that these items might be in the yarn or npm configuration. I eventually found the following from yarn config list:

yarn config v1.22.19
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.yarnpkg.com',
  'strict-ssl': true,
  'user-agent': 'yarn/1.22.19 npm/? node/v16.20.0 win32 x64',
  lastUpdateCheck: 1694458430079
}
info npm config
{
  'https://artifacts.company.com/artifactory/api/npm/company-npm/': '',
  registry: 'https://artifacts.company.com/artifactory/api/npm/company-npm/'
}
Done in 0.10s.

I first tried to use yarn config delete like I found here. Unfortunately, that didn’t work, so I instead had to npm config edit (reference), which did ultimately work.

After making those config changes, my system was once again able to build our projects against artifactory, and I was able to get on with my real work. Now that I’ve finally taken the time to write this up, hopefully it can help someone else who might run into a similar problem in the future.